diff --git a/arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx b/arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx index 5106640b8..2054cdcdb 100644 --- a/arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx +++ b/arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx @@ -16,6 +16,7 @@ import { StatusBar, StatusBarAlignment, } from '@theia/core/lib/browser'; +import { nls } from '@theia/core/lib/browser/nls'; import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution'; import { ColorRegistry } from '@theia/core/lib/browser/color-registry'; import { CommonMenus } from '@theia/core/lib/browser/common-frontend-contribution'; @@ -225,7 +226,10 @@ export class ArduinoFrontendContribution if (!window.navigator.onLine) { // tslint:disable-next-line:max-line-length this.messageService.warn( - 'You appear to be offline. Without an Internet connection, the Arduino CLI might not be able to download the required resources and could cause malfunction. Please connect to the Internet and restart the application.' + nls.localize( + 'arduino/common/offlineIndicator', + 'You appear to be offline. Without an Internet connection, the Arduino CLI might not be able to download the required resources and could cause malfunction. Please connect to the Internet and restart the application.' + ) ); } const updateStatusBar = ({ @@ -236,15 +240,22 @@ export class ArduinoFrontendContribution alignment: StatusBarAlignment.RIGHT, text: selectedBoard ? `$(microchip) ${selectedBoard.name}` - : '$(close) no board selected', + : `$(close) ${nls.localize( + 'arduino/common/noBoardSelected', + 'No board selected' + )}`, className: 'arduino-selected-board', }); if (selectedBoard) { this.statusBar.setElement('arduino-selected-port', { alignment: StatusBarAlignment.RIGHT, text: selectedPort - ? `on ${Port.toString(selectedPort)}` - : '[not connected]', + ? nls.localize( + 'arduino/common/selectedOn', + 'on {0}', + Port.toString(selectedPort) + ) + : nls.localize('arduino/common/notConnected', '[not connected]'), className: 'arduino-selected-port', }); } @@ -437,7 +448,7 @@ export class ArduinoFrontendContribution registry.registerItem({ id: 'toggle-serial-monitor', command: MonitorViewContribution.TOGGLE_SERIAL_MONITOR_TOOLBAR, - tooltip: 'Serial Monitor', + tooltip: nls.localize('arduino/common/serialMonitor', 'Serial Monitor'), }); } @@ -472,11 +483,20 @@ export class ArduinoFrontendContribution registry.getMenu(MAIN_MENU_BAR).removeNode(menuId(TerminalMenus.TERMINAL)); registry.getMenu(MAIN_MENU_BAR).removeNode(menuId(CommonMenus.VIEW)); - registry.registerSubmenu(ArduinoMenus.SKETCH, 'Sketch'); - registry.registerSubmenu(ArduinoMenus.TOOLS, 'Tools'); + registry.registerSubmenu( + ArduinoMenus.SKETCH, + nls.localize('arduino/menu/sketch', 'Sketch') + ); + registry.registerSubmenu( + ArduinoMenus.TOOLS, + nls.localize('arduino/menu/tools', 'Tools') + ); registry.registerMenuAction(ArduinoMenus.SKETCH__MAIN_GROUP, { commandId: ArduinoCommands.TOGGLE_COMPILE_FOR_DEBUG.id, - label: 'Optimize for Debugging', + label: nls.localize( + 'arduino/debug/optimizeForDebugging', + 'Optimize for Debugging' + ), order: '4', }); } @@ -490,11 +510,16 @@ export class ArduinoFrontendContribution } await this.ensureOpened(mainFileUri, true); if (mainFileUri.endsWith('.pde')) { - const message = `The '${sketch.name}' still uses the old \`.pde\` format. Do you want to switch to the new \`.ino\` extension?`; + const message = nls.localize( + 'arduino/common/oldFormat', + "The '{0}' still uses the old `.pde` format. Do you want to switch to the new `.ino` extension?", + sketch.name + ); + const yes = nls.localize('vscode/extensionsUtils/yes', 'Yes'); this.messageService - .info(message, 'Later', 'Yes') + .info(message, nls.localize('arduino/common/later', 'Later'), yes) .then(async (answer) => { - if (answer === 'Yes') { + if (answer === yes) { this.commandRegistry.executeCommand( SaveAsSketch.Commands.SAVE_AS_SKETCH.id, { diff --git a/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts b/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts index 4e126a561..ec572776f 100644 --- a/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts +++ b/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts @@ -253,6 +253,7 @@ import { UploadCertificateDialogProps, UploadCertificateDialogWidget, } from './dialogs/certificate-uploader/certificate-uploader-dialog'; +import { nls } from '@theia/core/lib/browser/nls'; const ElementQueries = require('css-element-queries/src/ElementQueries'); @@ -371,7 +372,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => { bind(BoardsConfigDialogWidget).toSelf().inSingletonScope(); bind(BoardsConfigDialog).toSelf().inSingletonScope(); bind(BoardsConfigDialogProps).toConstantValue({ - title: 'Select Board', + title: nls.localize('arduino/common/selectBoard', 'Select Board'), }); // Core service diff --git a/arduino-ide-extension/src/browser/arduino-preferences.ts b/arduino-ide-extension/src/browser/arduino-preferences.ts index d9aed5958..02de6d5ad 100644 --- a/arduino-ide-extension/src/browser/arduino-preferences.ts +++ b/arduino-ide-extension/src/browser/arduino-preferences.ts @@ -6,6 +6,7 @@ import { PreferenceContribution, PreferenceSchema, } from '@theia/core/lib/browser/preferences'; +import { nls } from '@theia/core/lib/browser/nls'; import { CompilerWarningLiterals, CompilerWarnings } from '../common/protocol'; export const ArduinoConfigSchema: PreferenceSchema = { @@ -13,24 +14,34 @@ export const ArduinoConfigSchema: PreferenceSchema = { properties: { 'arduino.language.log': { type: 'boolean', - description: - "True if the Arduino Language Server should generate log files into the sketch folder. Otherwise, false. It's false by default.", + description: nls.localize( + 'arduino/preferences/language.log', + "True if the Arduino Language Server should generate log files into the sketch folder. Otherwise, false. It's false by default." + ), default: false, }, 'arduino.compile.verbose': { type: 'boolean', - description: 'True for verbose compile output. False by default', + description: nls.localize( + 'arduino/preferences/compile.verbose', + 'True for verbose compile output. False by default' + ), default: false, }, 'arduino.compile.warnings': { enum: [...CompilerWarningLiterals], - description: - "Tells gcc which warning level to use. It's 'None' by default", + description: nls.localize( + 'arduino/preferences/compile.warnings', + "Tells gcc which warning level to use. It's 'None' by default" + ), default: 'None', }, 'arduino.upload.verbose': { type: 'boolean', - description: 'True for verbose upload output. False by default.', + description: nls.localize( + 'arduino/preferences/upload.verbose', + 'True for verbose upload output. False by default.' + ), default: false, }, 'arduino.upload.verify': { @@ -39,81 +50,114 @@ export const ArduinoConfigSchema: PreferenceSchema = { }, 'arduino.window.autoScale': { type: 'boolean', - description: - 'True if the user interface automatically scales with the font size.', + description: nls.localize( + 'arduino/preferences/window.autoScale', + 'True if the user interface automatically scales with the font size.' + ), default: true, }, 'arduino.window.zoomLevel': { type: 'number', - description: - 'Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1) or below (e.g. -1) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity.', + description: nls.localize( + 'arduino/preferences/window.zoomLevel', + 'Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1) or below (e.g. -1) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity.' + ), default: 0, }, 'arduino.ide.autoUpdate': { type: 'boolean', - description: - 'True to enable automatic update checks. The IDE will check for updates automatically and periodically.', + description: nls.localize( + 'arduino/preferences/ide.autoUpdate', + 'True to enable automatic update checks. The IDE will check for updates automatically and periodically.' + ), default: true, }, 'arduino.board.certificates': { type: 'string', - description: 'List of certificates that can be uploaded to boards', + description: nls.localize( + 'arduino/preferences/board.certificates', + 'List of certificates that can be uploaded to boards' + ), default: '', }, 'arduino.sketchbook.showAllFiles': { type: 'boolean', - description: - 'True to show all sketch files inside the sketch. It is false by default.', + description: nls.localize( + 'arduino/preferences/sketchbook.showAllFiles', + 'True to show all sketch files inside the sketch. It is false by default.' + ), default: false, }, 'arduino.cloud.enabled': { type: 'boolean', - description: - 'True if the sketch sync functions are enabled. Defaults to true.', + description: nls.localize( + 'arduino/preferences/cloud.enabled', + 'True if the sketch sync functions are enabled. Defaults to true.' + ), default: true, }, 'arduino.cloud.pull.warn': { type: 'boolean', - description: - 'True if users should be warned before pulling a cloud sketch. Defaults to true.', + description: nls.localize( + 'arduino/preferences/cloud.pull.warn', + 'True if users should be warned before pulling a cloud sketch. Defaults to true.' + ), default: true, }, 'arduino.cloud.push.warn': { type: 'boolean', - description: - 'True if users should be warned before pushing a cloud sketch. Defaults to true.', + description: nls.localize( + 'arduino/preferences/cloud.push.warn', + 'True if users should be warned before pushing a cloud sketch. Defaults to true.' + ), default: true, }, 'arduino.cloud.pushpublic.warn': { type: 'boolean', - description: - 'True if users should be warned before pushing a public sketch to the cloud. Defaults to true.', + description: nls.localize( + 'arduino/preferences/cloud.pushpublic.warn', + 'True if users should be warned before pushing a public sketch to the cloud. Defaults to true.' + ), default: true, }, 'arduino.cloud.sketchSyncEnpoint': { type: 'string', - description: - 'The endpoint used to push and pull sketches from a backend. By default it points to Arduino Cloud API.', + description: nls.localize( + 'arduino/preferences/cloud.sketchSyncEnpoint', + 'The endpoint used to push and pull sketches from a backend. By default it points to Arduino Cloud API.' + ), default: 'https://api2.arduino.cc/create', }, 'arduino.auth.clientID': { type: 'string', - description: 'The OAuth2 client ID.', + description: nls.localize( + 'arduino/preferences/auth.clientID', + 'The OAuth2 client ID.' + ), default: 'C34Ya6ex77jTNxyKWj01lCe1vAHIaPIo', }, 'arduino.auth.domain': { type: 'string', - description: 'The OAuth2 domain.', + description: nls.localize( + 'arduino/preferences/auth.domain', + 'The OAuth2 domain.' + ), default: 'login.arduino.cc', }, 'arduino.auth.audience': { type: 'string', - description: 'The 0Auth2 audience.', + description: nls.localize( + 'arduino/preferences/auth.audience', + 'The OAuth2 audience.' + ), default: 'https://api.arduino.cc', }, 'arduino.auth.registerUri': { type: 'string', - description: 'The URI used to register a new user.', + description: nls.localize( + 'arduino/preferences/auth.registerUri', + 'The URI used to register a new user.' + ), default: 'https://auth.arduino.cc/login#/register', }, }, diff --git a/arduino-ide-extension/src/browser/auth/cloud-user-commands.ts b/arduino-ide-extension/src/browser/auth/cloud-user-commands.ts index 7a4d6c89e..165d5bda7 100644 --- a/arduino-ide-extension/src/browser/auth/cloud-user-commands.ts +++ b/arduino-ide-extension/src/browser/auth/cloud-user-commands.ts @@ -1,15 +1,21 @@ import { Command } from '@theia/core/lib/common/command'; export namespace CloudUserCommands { - export const LOGIN: Command = { - id: 'arduino-cloud--login', - label: 'Sign in', - }; + export const LOGIN = Command.toLocalizedCommand( + { + id: 'arduino-cloud--login', + label: 'Sign in', + }, + 'arduino/cloud/signIn' + ); - export const LOGOUT: Command = { - id: 'arduino-cloud--logout', - label: 'Sign Out', - }; + export const LOGOUT = Command.toLocalizedCommand( + { + id: 'arduino-cloud--logout', + label: 'Sign Out', + }, + 'arduino/cloud/signOut' + ); export const OPEN_PROFILE_CONTEXT_MENU: Command = { id: 'arduino-cloud-sketchbook--open-profile-menu', diff --git a/arduino-ide-extension/src/browser/boards/boards-auto-installer.ts b/arduino-ide-extension/src/browser/boards/boards-auto-installer.ts index 61a5c26e3..e99618d96 100644 --- a/arduino-ide-extension/src/browser/boards/boards-auto-installer.ts +++ b/arduino-ide-extension/src/browser/boards/boards-auto-installer.ts @@ -10,6 +10,7 @@ import { BoardsServiceProvider } from './boards-service-provider'; import { BoardsConfig } from './boards-config'; import { Installable, ResponseServiceArduino } from '../../common/protocol'; import { BoardsListWidgetFrontendContribution } from './boards-widget-frontend-contribution'; +import { nls } from '@theia/core/lib/browser/nls'; /** * Listens on `BoardsConfig.Config` changes, if a board is selected which does not @@ -81,12 +82,23 @@ export class BoardsAutoInstaller implements FrontendApplicationContribution { const version = candidate.availableVersions[0] ? `[v ${candidate.availableVersions[0]}]` : ''; + const yes = nls.localize('vscode/extensionsUtils/yes', 'Yes'); + const manualInstall = nls.localize( + 'arduino/board/installManually', + 'Install Manually' + ); // tslint:disable-next-line:max-line-length this.messageService .info( - `The \`"${candidate.name} ${version}"\` core has to be installed for the currently selected \`"${selectedBoard.name}"\` board. Do you want to install it now?`, - 'Install Manually', - 'Yes' + nls.localize( + 'arduino/board/installNow', + 'The "{0} {1}" core has to be installed for the currently selected "{2}" board. Do you want to install it now?', + candidate.name, + version, + selectedBoard.name + ), + manualInstall, + yes ) .then(async (answer) => { const index = this.notifications.findIndex((board) => @@ -95,7 +107,7 @@ export class BoardsAutoInstaller implements FrontendApplicationContribution { if (index !== -1) { this.notifications.splice(index, 1); } - if (answer === 'Yes') { + if (answer === yes) { await Installable.installWithProgress({ installable: this.boardsService, item: candidate, @@ -105,7 +117,7 @@ export class BoardsAutoInstaller implements FrontendApplicationContribution { }); return; } - if (answer === 'Install Manually') { + if (answer === manualInstall) { this.boardsManagerFrontendContribution .openView({ reveal: true }) .then((widget) => diff --git a/arduino-ide-extension/src/browser/boards/boards-config-dialog.ts b/arduino-ide-extension/src/browser/boards/boards-config-dialog.ts index 48ccc828a..8f44eef8d 100644 --- a/arduino-ide-extension/src/browser/boards/boards-config-dialog.ts +++ b/arduino-ide-extension/src/browser/boards/boards-config-dialog.ts @@ -6,6 +6,7 @@ import { BoardsConfig } from './boards-config'; import { BoardsService } from '../../common/protocol/boards-service'; import { BoardsServiceProvider } from './boards-service-provider'; import { BoardsConfigDialogWidget } from './boards-config-dialog-widget'; +import { nls } from '@theia/core/lib/browser/nls'; @injectable() export class BoardsConfigDialogProps extends DialogProps {} @@ -32,8 +33,10 @@ export class BoardsConfigDialog extends AbstractDialog { this.contentNode.classList.add('select-board-dialog'); this.contentNode.appendChild(this.createDescription()); - this.appendCloseButton('CANCEL'); - this.appendAcceptButton('OK'); + this.appendCloseButton( + nls.localize('vscode/issueMainService/cancel', 'Cancel') + ); + this.appendAcceptButton(nls.localize('vscode/issueMainService/ok', 'OK')); } @postConstruct() @@ -63,7 +66,10 @@ export class BoardsConfigDialog extends AbstractDialog { head.classList.add('head'); const title = document.createElement('div'); - title.textContent = 'Select Other Board & Port'; + title.textContent = nls.localize( + 'arduino/board/configDialogTitle', + 'Select Other Board & Port' + ); title.classList.add('title'); head.appendChild(title); @@ -72,8 +78,14 @@ export class BoardsConfigDialog extends AbstractDialog { head.appendChild(text); for (const paragraph of [ - 'Select both a Board and a Port if you want to upload a sketch.', - 'If you only select a Board you will be able just to compile, but not to upload your sketch.', + nls.localize( + 'arduino/board/configDialog1', + 'Select both a Board and a Port if you want to upload a sketch.' + ), + nls.localize( + 'arduino/board/configDialog2', + 'If you only select a Board you will be able just to compile, but not to upload your sketch.' + ), ]) { const p = document.createElement('div'); p.textContent = paragraph; @@ -117,7 +129,10 @@ export class BoardsConfigDialog extends AbstractDialog { protected isValid(value: BoardsConfig.Config): DialogError { if (!value.selectedBoard) { if (value.selectedPort) { - return 'Please pick a board connected to the port you have selected.'; + return nls.localize( + 'arduino/board/pleasePickBoard', + 'Please pick a board connected to the port you have selected.' + ); } return false; } diff --git a/arduino-ide-extension/src/browser/boards/boards-config.tsx b/arduino-ide-extension/src/browser/boards/boards-config.tsx index d4772a2e6..e2ac717ca 100644 --- a/arduino-ide-extension/src/browser/boards/boards-config.tsx +++ b/arduino-ide-extension/src/browser/boards/boards-config.tsx @@ -11,6 +11,7 @@ import { } from '../../common/protocol/boards-service'; import { NotificationCenter } from '../notification-center'; import { BoardsServiceProvider } from './boards-service-provider'; +import { nls } from '@theia/core/lib/browser/nls'; export namespace BoardsConfig { export interface Config { @@ -302,7 +303,12 @@ export class BoardsConfig extends React.Component< protected renderPortsFooter(): React.ReactNode { return (
-