patch en locale messages for compiler-container

pull/4067/head
drafish 2 years ago committed by Aniket
parent 9f2d07e0eb
commit 0262533b93
  1. 28
      apps/remix-ide/src/app/tabs/locales/en/solidity.json
  2. 70
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx

@ -1,5 +1,7 @@
{
"solidity.displayName": "Solidity compiler",
"solidity._comment_path1": "libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx",
"solidity.compiler": "Compiler",
"solidity.addACustomCompiler": "Add a custom compiler",
"solidity.addACustomCompilerWithURL": "Add a custom compiler with URL",
@ -21,6 +23,32 @@
"solidity.compile": "Compile",
"solidity.noFileSelected": "no file selected",
"solidity.compileAndRunScript": "Compile and Run script",
"solidity.newConfigFileTitle": "New configuration file",
"solidity.newConfigFileMessage": "The file \"{configFilePathInput}\" you entered does not exist. Do you want to create a new one?",
"solidity.create": "Create",
"solidity.ok": "OK",
"solidity.cancel": "Cancel",
"solidity.noFileSelected1": "No file selected.",
"solidity.toCompile": "to compile",
"solidity.noConfigFileSelected": "No config file selected",
"solidity.copyNatSpecTag": "Click to copy the custom NatSpec tag",
"solidity.inputTitle1": "If the file you entered does not exist you will be able to create one in the next step.",
"solidity.inputTitle2": "Estimated number of times each opcode of the deployed code will be executed across the life-time of the contract.",
"solidity.tooltipText1": "Choose the script to execute right after compilation by adding the `dev-run-script` natspec tag, as in:",
"solidity.tooltipText2": "Click the \"i\" icon to learn more",
"solidity.tooltipText3": "for compiling and script execution",
"solidity.tooltipText4": "Click to open the config file",
"solidity.tooltipText5": "Cannot load compiler version list. It might have been blocked by an advertisement blocker. Please try deactivating any of them from this page and reload. Error: ",
"solidity.tooltipText6": "Language specification available from Compiler >= v0.5.7",
"solidity.toastMessage": "Updating compiler version to match current contract file pragma i.e {version}",
"solidity.compileIconAttribute": "compiler is loading, please wait a few moments.",
"solidity.compilerLicense": "Compiler License",
"solidity.compilerLicenseMsg1": "Compiler is loading. License will be displayed once compiler is loaded",
"solidity.compilerLicenseMsg2": "Could not retreive license for selected compiler version",
"solidity.compilerLicenseMsg3": "License not available",
"solidity.seeCompilerLicense": "See compiler license",
"solidity._comment_path2": "libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx",
"solidity.publishOn": "Publish on",
"solidity.flatten": "Flatten contracts before UML generation.",
"solidity.generateUML": "Generate a UML diagram of your contract.",

@ -274,12 +274,12 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
setShowFilePathInput(false)
} else {
modal(
'New configuration file',
`The file "${configFilePathInput.current.value}" you entered does not exist. Do you want to create a new one?`,
'Create',
intl.formatMessage({id: 'solidity.newConfigFileTitle'}),
intl.formatMessage({id: 'solidity.newConfigFileMessage'}, {configFilePathInput: configFilePathInput.current.value}),
intl.formatMessage({id: 'solidity.create'}),
async () => await createNewConfigFile(),
false,
'Cancel',
intl.formatMessage({id: 'solidity.cancel'}),
() => {
setShowFilePathInput(false)
}
@ -337,9 +337,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
allVersionsWasm = wasmRes.data.builds.slice().reverse()
}
} catch (e) {
tooltip(
'Cannot load compiler version list. It might have been blocked by an advertisement blocker. Please try deactivating any of them from this page and reload. Error: ' + e
)
tooltip(intl.formatMessage({id: 'solidity.tooltipText5'}) + e)
}
// replace in allVersions those compiler builds which exist in allVersionsWasm with new once
if (allVersionsWasm && allVersions) {
@ -399,7 +397,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const compilerPath = state.allversions.filter((obj) => !obj.prerelease && obj.version === compilerToLoad)[0].path
if (state.selectedVersion !== compilerPath) {
// @ts-ignore
api.call('notification', 'toast', `Updating compiler version to match current contract file pragma i.e ${_retrieveVersion(compilerPath)}`)
api.call('notification', 'toast', intl.formatMessage({id: 'solidity.toastMessage'}, {version: _retrieveVersion(compilerPath)}))
setState((prevState) => {
return {...prevState, selectedVersion: compilerPath}
})
@ -443,12 +441,12 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const loadingCompiler = () => {
if (!compileIcon.current) return
compileIcon.current.setAttribute('title', 'compiler is loading, please wait a few moments.')
compileIcon.current.setAttribute('title', intl.formatMessage({id: 'solidity.compileIconAttribute'}))
compileIcon.current.classList.add('remixui_spinningIcon')
setState((prevState) => {
return {
...prevState,
compilerLicense: 'Compiler is loading. License will be displayed once compiler is loaded'
compilerLicense: intl.formatMessage({id: 'solidity.compilerLicenseMsg1'})
}
})
_updateLanguageSelector()
@ -462,7 +460,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
setState((prevState) => {
return {
...prevState,
compilerLicense: license ? license : 'Could not retreive license for selected compiler version'
compilerLicense: license ? license : intl.formatMessage({id: 'solidity.compilerLicenseMsg2'})
}
})
if (state.autoCompile) compile()
@ -592,16 +590,21 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
id: 'solidity.addACustomCompiler'
}),
promptMessage('URL'),
'OK',
intl.formatMessage({id: 'solidity.ok'}),
addCustomCompiler,
false,
'Cancel',
intl.formatMessage({id: 'solidity.cancel'}),
() => {}
)
}
const showCompilerLicense = () => {
modal('Compiler License', state.compilerLicense ? state.compilerLicense : 'License not available', 'OK', () => {})
modal(
intl.formatMessage({id: 'solidity.compilerLicense'}),
state.compilerLicense ? state.compilerLicense : intl.formatMessage({id: 'solidity.compilerLicenseMsg3'}),
intl.formatMessage({id: 'solidity.ok'}),
() => {}
)
}
const promptMessage = (message) => {
@ -766,7 +769,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
>
<span className="far fa-plus border-0 p-0 ml-3" onClick={() => promptCompiler()}></span>
</CustomTooltip>
<CustomTooltip placement="top" tooltipId="showCompilerTooltip" tooltipClasses="text-nowrap" tooltipText={'See compiler license'}>
<CustomTooltip placement="top" tooltipId="showCompilerTooltip" tooltipClasses="text-nowrap" tooltipText={<FormattedMessage id="solidity.seeCompilerLicense" />}>
<span className="fa fa-file-text-o border-0 p-0 ml-2" onClick={() => showCompilerLicense()}></span>
</CustomTooltip>
<select
@ -928,7 +931,11 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
placement="right"
tooltipId="compilerLabelTooltip"
tooltipClasses="text-nowrap"
tooltipText={<span>{'Language specification available from Compiler >= v0.5.7'}</span>}
tooltipText={
<span>
<FormattedMessage id="solidity.tooltipText6" />
</span>
}
>
<div id="compilerLanguageSelectorWrapper">
<select
@ -991,7 +998,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
placeholder="200"
value={state.runs}
type="number"
title="Estimated number of times each opcode of the deployed code will be executed across the life-time of the contract."
title={intl.formatMessage({id: 'solidity.inputTitle2'})}
onChange={(e) => onChangeRuns(e.target.value)}
disabled={!state.optimize || state.useFileConfiguration}
/>
@ -1014,7 +1021,16 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
</div>
<div className={`pt-2 ml-4 ml-2 align-items-start justify-content-between d-flex`}>
{!showFilePathInput && state.useFileConfiguration && (
<CustomTooltip placement="bottom" tooltipId="configfileTooltip" tooltipClasses="text-nowrap" tooltipText={<span>Click to open the config file</span>}>
<CustomTooltip
placement="bottom"
tooltipId="configfileTooltip"
tooltipClasses="text-nowrap"
tooltipText={
<span>
<FormattedMessage id="solidity.tooltipText4" />
</span>
}
>
<span
onClick={
configFilePath === ''
@ -1025,7 +1041,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
}
className="py-2 remixui_compilerConfigPath"
>
{configFilePath === '' ? 'No file selected.' : configFilePath}
{configFilePath === '' ? intl.formatMessage({id: 'solidity.noFileSelected1'}) : configFilePath}
</span>
</CustomTooltip>
)}
@ -1034,7 +1050,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
ref={configFilePathInput}
className={`py-0 my-0 form-control ${showFilePathInput ? 'd-flex' : 'd-none'}`}
placeholder={'/folder_path/file_name.json'}
title="If the file you entered does not exist you will be able to create one in the next step."
title={intl.formatMessage({id: 'solidity.inputTitle1'})}
disabled={!state.useFileConfiguration}
data-id="scConfigFilePathInput"
onKeyPress={(event) => {
@ -1072,10 +1088,10 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
<div className="text-left">
{!(configFilePath === '' && state.useFileConfiguration) && (
<div>
<b>Ctrl+S</b> to compile {state.compiledFileName.endsWith('.sol') ? state.compiledFileName : null}{' '}
<b>Ctrl+S</b> <FormattedMessage id="solidity.toCompile" /> {state.compiledFileName.endsWith('.sol') ? state.compiledFileName : null}{' '}
</div>
)}
{configFilePath === '' && state.useFileConfiguration && <div> No config file selected</div>}
{configFilePath === '' && state.useFileConfiguration && <div> <FormattedMessage id="solidity.noConfigFileSelected" /></div>}
</div>
}
>
@ -1114,10 +1130,10 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
<div className="text-left">
{!(configFilePath === '' && state.useFileConfiguration) && (
<div>
<b>Ctrl+Shift+S</b> for compiling and script execution
<b>Ctrl+Shift+S</b> <FormattedMessage id="solidity.tooltipText3" />
</div>
)}
{configFilePath === '' && state.useFileConfiguration && <div> No config file selected</div>}
{configFilePath === '' && state.useFileConfiguration && <div> <FormattedMessage id="solidity.noConfigFileSelected" /></div>}
</div>
}
>
@ -1131,7 +1147,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
tooltipId="overlay-tooltip-compile-run-doc"
tooltipText={
<div className="text-left p-2">
<div>Choose the script to execute right after compilation by adding the `dev-run-script` natspec tag, as in:</div>
<div><FormattedMessage id="solidity.tooltipText1" /></div>
<pre>
<code>
/**
@ -1148,7 +1164,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
<br />
</code>
</pre>
Click the "i" icon to learn more
<FormattedMessage id="solidity.tooltipText2" />
</div>
}
>
@ -1156,7 +1172,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
<i className="pl-2 ml-2 fas fa-info text-dark"></i>
</a>
</CustomTooltip>
<CopyToClipboard tip="Click to copy the custom NatSpec tag" getContent={() => '@custom:dev-run-script file_path'} direction="top">
<CopyToClipboard tip={intl.formatMessage({id: 'solidity.copyNatSpecTag'})} getContent={() => '@custom:dev-run-script file_path'} direction="top">
<button className="btn remixui_copyButton ml-2 my-1 text-dark">
<i className="remixui_copyIcon far fa-copy" aria-hidden="true"></i>
</button>

Loading…
Cancel
Save