Skip to content

Commit 0a6afba

Browse files
committed
Translating Arduino-IDE using Theia's nls API
1 parent 1c42b8c commit 0a6afba

File tree

76 files changed

+1450
-504
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1450
-504
lines changed

Diff for: arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx

+36-11
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
StatusBar,
1717
StatusBarAlignment,
1818
} from '@theia/core/lib/browser';
19+
import { nls } from '@theia/core/lib/browser/nls';
1920
import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution';
2021
import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
2122
import { CommonMenus } from '@theia/core/lib/browser/common-frontend-contribution';
@@ -225,7 +226,10 @@ export class ArduinoFrontendContribution
225226
if (!window.navigator.onLine) {
226227
// tslint:disable-next-line:max-line-length
227228
this.messageService.warn(
228-
'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.'
229+
nls.localize(
230+
'arduino/common/offlineIndicator',
231+
'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.'
232+
)
229233
);
230234
}
231235
const updateStatusBar = ({
@@ -236,15 +240,22 @@ export class ArduinoFrontendContribution
236240
alignment: StatusBarAlignment.RIGHT,
237241
text: selectedBoard
238242
? `$(microchip) ${selectedBoard.name}`
239-
: '$(close) no board selected',
243+
: `$(close) ${nls.localize(
244+
'arduino/common/noBoardSelected',
245+
'No board selected'
246+
)}`,
240247
className: 'arduino-selected-board',
241248
});
242249
if (selectedBoard) {
243250
this.statusBar.setElement('arduino-selected-port', {
244251
alignment: StatusBarAlignment.RIGHT,
245252
text: selectedPort
246-
? `on ${Port.toString(selectedPort)}`
247-
: '[not connected]',
253+
? nls.localize(
254+
'arduino/common/selectedOn',
255+
'on {0}',
256+
Port.toString(selectedPort)
257+
)
258+
: nls.localize('arduino/common/notConnected', '[not connected]'),
248259
className: 'arduino-selected-port',
249260
});
250261
}
@@ -437,7 +448,7 @@ export class ArduinoFrontendContribution
437448
registry.registerItem({
438449
id: 'toggle-serial-monitor',
439450
command: MonitorViewContribution.TOGGLE_SERIAL_MONITOR_TOOLBAR,
440-
tooltip: 'Serial Monitor',
451+
tooltip: nls.localize('arduino/common/serialMonitor', 'Serial Monitor'),
441452
});
442453
}
443454

@@ -472,11 +483,20 @@ export class ArduinoFrontendContribution
472483
registry.getMenu(MAIN_MENU_BAR).removeNode(menuId(TerminalMenus.TERMINAL));
473484
registry.getMenu(MAIN_MENU_BAR).removeNode(menuId(CommonMenus.VIEW));
474485

475-
registry.registerSubmenu(ArduinoMenus.SKETCH, 'Sketch');
476-
registry.registerSubmenu(ArduinoMenus.TOOLS, 'Tools');
486+
registry.registerSubmenu(
487+
ArduinoMenus.SKETCH,
488+
nls.localize('arduino/menu/sketch', 'Sketch')
489+
);
490+
registry.registerSubmenu(
491+
ArduinoMenus.TOOLS,
492+
nls.localize('arduino/menu/tools', 'Tools')
493+
);
477494
registry.registerMenuAction(ArduinoMenus.SKETCH__MAIN_GROUP, {
478495
commandId: ArduinoCommands.TOGGLE_COMPILE_FOR_DEBUG.id,
479-
label: 'Optimize for Debugging',
496+
label: nls.localize(
497+
'arduino/debug/optimizeForDebugging',
498+
'Optimize for Debugging'
499+
),
480500
order: '4',
481501
});
482502
}
@@ -490,11 +510,16 @@ export class ArduinoFrontendContribution
490510
}
491511
await this.ensureOpened(mainFileUri, true);
492512
if (mainFileUri.endsWith('.pde')) {
493-
const message = `The '${sketch.name}' still uses the old \`.pde\` format. Do you want to switch to the new \`.ino\` extension?`;
513+
const message = nls.localize(
514+
'arduino/common/oldFormat',
515+
"The '{0}' still uses the old `.pde` format. Do you want to switch to the new `.ino` extension?",
516+
sketch.name
517+
);
518+
const yes = nls.localize('vscode/extensionsUtils/yes', 'Yes');
494519
this.messageService
495-
.info(message, 'Later', 'Yes')
520+
.info(message, nls.localize('arduino/common/later', 'Later'), yes)
496521
.then(async (answer) => {
497-
if (answer === 'Yes') {
522+
if (answer === yes) {
498523
this.commandRegistry.executeCommand(
499524
SaveAsSketch.Commands.SAVE_AS_SKETCH.id,
500525
{

Diff for: arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ import {
253253
UploadCertificateDialogProps,
254254
UploadCertificateDialogWidget,
255255
} from './dialogs/certificate-uploader/certificate-uploader-dialog';
256+
import { nls } from '@theia/core/lib/browser/nls';
256257

257258
const ElementQueries = require('css-element-queries/src/ElementQueries');
258259

@@ -371,7 +372,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
371372
bind(BoardsConfigDialogWidget).toSelf().inSingletonScope();
372373
bind(BoardsConfigDialog).toSelf().inSingletonScope();
373374
bind(BoardsConfigDialogProps).toConstantValue({
374-
title: 'Select Board',
375+
title: nls.localize('arduino/common/selectBoard', 'Select Board'),
375376
});
376377

377378
// Core service

Diff for: arduino-ide-extension/src/browser/arduino-preferences.ts

+73-29
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,42 @@ import {
66
PreferenceContribution,
77
PreferenceSchema,
88
} from '@theia/core/lib/browser/preferences';
9+
import { nls } from '@theia/core/lib/browser/nls';
910
import { CompilerWarningLiterals, CompilerWarnings } from '../common/protocol';
1011

1112
export const ArduinoConfigSchema: PreferenceSchema = {
1213
type: 'object',
1314
properties: {
1415
'arduino.language.log': {
1516
type: 'boolean',
16-
description:
17-
"True if the Arduino Language Server should generate log files into the sketch folder. Otherwise, false. It's false by default.",
17+
description: nls.localize(
18+
'arduino/preferences/language.log',
19+
"True if the Arduino Language Server should generate log files into the sketch folder. Otherwise, false. It's false by default."
20+
),
1821
default: false,
1922
},
2023
'arduino.compile.verbose': {
2124
type: 'boolean',
22-
description: 'True for verbose compile output. False by default',
25+
description: nls.localize(
26+
'arduino/preferences/compile.verbose',
27+
'True for verbose compile output. False by default'
28+
),
2329
default: false,
2430
},
2531
'arduino.compile.warnings': {
2632
enum: [...CompilerWarningLiterals],
27-
description:
28-
"Tells gcc which warning level to use. It's 'None' by default",
33+
description: nls.localize(
34+
'arduino/preferences/compile.warnings',
35+
"Tells gcc which warning level to use. It's 'None' by default"
36+
),
2937
default: 'None',
3038
},
3139
'arduino.upload.verbose': {
3240
type: 'boolean',
33-
description: 'True for verbose upload output. False by default.',
41+
description: nls.localize(
42+
'arduino/preferences/upload.verbose',
43+
'True for verbose upload output. False by default.'
44+
),
3445
default: false,
3546
},
3647
'arduino.upload.verify': {
@@ -39,81 +50,114 @@ export const ArduinoConfigSchema: PreferenceSchema = {
3950
},
4051
'arduino.window.autoScale': {
4152
type: 'boolean',
42-
description:
43-
'True if the user interface automatically scales with the font size.',
53+
description: nls.localize(
54+
'arduino/preferences/window.autoScale',
55+
'True if the user interface automatically scales with the font size.'
56+
),
4457
default: true,
4558
},
4659
'arduino.window.zoomLevel': {
4760
type: 'number',
48-
description:
49-
'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.',
61+
description: nls.localize(
62+
'arduino/preferences/window.zoomLevel',
63+
'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.'
64+
),
5065
default: 0,
5166
},
5267
'arduino.ide.autoUpdate': {
5368
type: 'boolean',
54-
description:
55-
'True to enable automatic update checks. The IDE will check for updates automatically and periodically.',
69+
description: nls.localize(
70+
'arduino/preferences/ide.autoUpdate',
71+
'True to enable automatic update checks. The IDE will check for updates automatically and periodically.'
72+
),
5673
default: true,
5774
},
5875
'arduino.board.certificates': {
5976
type: 'string',
60-
description: 'List of certificates that can be uploaded to boards',
77+
description: nls.localize(
78+
'arduino/preferences/board.certificates',
79+
'List of certificates that can be uploaded to boards'
80+
),
6181
default: '',
6282
},
6383
'arduino.sketchbook.showAllFiles': {
6484
type: 'boolean',
65-
description:
66-
'True to show all sketch files inside the sketch. It is false by default.',
85+
description: nls.localize(
86+
'arduino/preferences/sketchbook.showAllFiles',
87+
'True to show all sketch files inside the sketch. It is false by default.'
88+
),
6789
default: false,
6890
},
6991
'arduino.cloud.enabled': {
7092
type: 'boolean',
71-
description:
72-
'True if the sketch sync functions are enabled. Defaults to true.',
93+
description: nls.localize(
94+
'arduino/preferences/cloud.enabled',
95+
'True if the sketch sync functions are enabled. Defaults to true.'
96+
),
7397
default: true,
7498
},
7599
'arduino.cloud.pull.warn': {
76100
type: 'boolean',
77-
description:
78-
'True if users should be warned before pulling a cloud sketch. Defaults to true.',
101+
description: nls.localize(
102+
'arduino/preferences/cloud.pull.warn',
103+
'True if users should be warned before pulling a cloud sketch. Defaults to true.'
104+
),
79105
default: true,
80106
},
81107
'arduino.cloud.push.warn': {
82108
type: 'boolean',
83-
description:
84-
'True if users should be warned before pushing a cloud sketch. Defaults to true.',
109+
description: nls.localize(
110+
'arduino/preferences/cloud.push.warn',
111+
'True if users should be warned before pushing a cloud sketch. Defaults to true.'
112+
),
85113
default: true,
86114
},
87115
'arduino.cloud.pushpublic.warn': {
88116
type: 'boolean',
89-
description:
90-
'True if users should be warned before pushing a public sketch to the cloud. Defaults to true.',
117+
description: nls.localize(
118+
'arduino/preferences/cloud.pushpublic.warn',
119+
'True if users should be warned before pushing a public sketch to the cloud. Defaults to true.'
120+
),
91121
default: true,
92122
},
93123
'arduino.cloud.sketchSyncEnpoint': {
94124
type: 'string',
95-
description:
96-
'The endpoint used to push and pull sketches from a backend. By default it points to Arduino Cloud API.',
125+
description: nls.localize(
126+
'arduino/preferences/cloud.sketchSyncEnpoint',
127+
'The endpoint used to push and pull sketches from a backend. By default it points to Arduino Cloud API.'
128+
),
97129
default: 'https://api2.arduino.cc/create',
98130
},
99131
'arduino.auth.clientID': {
100132
type: 'string',
101-
description: 'The OAuth2 client ID.',
133+
description: nls.localize(
134+
'arduino/preferences/auth.clientID',
135+
'The OAuth2 client ID.'
136+
),
102137
default: 'C34Ya6ex77jTNxyKWj01lCe1vAHIaPIo',
103138
},
104139
'arduino.auth.domain': {
105140
type: 'string',
106-
description: 'The OAuth2 domain.',
141+
description: nls.localize(
142+
'arduino/preferences/auth.domain',
143+
'The OAuth2 domain.'
144+
),
107145
default: 'login.arduino.cc',
108146
},
109147
'arduino.auth.audience': {
110148
type: 'string',
111-
description: 'The 0Auth2 audience.',
149+
description: nls.localize(
150+
'arduino/preferences/auth.audience',
151+
'The OAuth2 audience.'
152+
),
112153
default: 'https://api.arduino.cc',
113154
},
114155
'arduino.auth.registerUri': {
115156
type: 'string',
116-
description: 'The URI used to register a new user.',
157+
description: nls.localize(
158+
'arduino/preferences/auth.registerUri',
159+
'The URI used to register a new user.'
160+
),
117161
default: 'https://auth.arduino.cc/login#/register',
118162
},
119163
},

Diff for: arduino-ide-extension/src/browser/auth/cloud-user-commands.ts

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
import { Command } from '@theia/core/lib/common/command';
22

33
export namespace CloudUserCommands {
4-
export const LOGIN: Command = {
5-
id: 'arduino-cloud--login',
6-
label: 'Sign in',
7-
};
4+
export const LOGIN = Command.toLocalizedCommand(
5+
{
6+
id: 'arduino-cloud--login',
7+
label: 'Sign in',
8+
},
9+
'arduino/cloud/signIn'
10+
);
811

9-
export const LOGOUT: Command = {
10-
id: 'arduino-cloud--logout',
11-
label: 'Sign Out',
12-
};
12+
export const LOGOUT = Command.toLocalizedCommand(
13+
{
14+
id: 'arduino-cloud--logout',
15+
label: 'Sign Out',
16+
},
17+
'arduino/cloud/signOut'
18+
);
1319

1420
export const OPEN_PROFILE_CONTEXT_MENU: Command = {
1521
id: 'arduino-cloud-sketchbook--open-profile-menu',

Diff for: arduino-ide-extension/src/browser/boards/boards-auto-installer.ts

+17-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { BoardsServiceProvider } from './boards-service-provider';
1010
import { BoardsConfig } from './boards-config';
1111
import { Installable, ResponseServiceArduino } from '../../common/protocol';
1212
import { BoardsListWidgetFrontendContribution } from './boards-widget-frontend-contribution';
13+
import { nls } from '@theia/core/lib/browser/nls';
1314

1415
/**
1516
* Listens on `BoardsConfig.Config` changes, if a board is selected which does not
@@ -81,12 +82,23 @@ export class BoardsAutoInstaller implements FrontendApplicationContribution {
8182
const version = candidate.availableVersions[0]
8283
? `[v ${candidate.availableVersions[0]}]`
8384
: '';
85+
const yes = nls.localize('vscode/extensionsUtils/yes', 'Yes');
86+
const manualInstall = nls.localize(
87+
'arduino/board/installManually',
88+
'Install Manually'
89+
);
8490
// tslint:disable-next-line:max-line-length
8591
this.messageService
8692
.info(
87-
`The \`"${candidate.name} ${version}"\` core has to be installed for the currently selected \`"${selectedBoard.name}"\` board. Do you want to install it now?`,
88-
'Install Manually',
89-
'Yes'
93+
nls.localize(
94+
'arduino/board/installNow',
95+
'The "{0} {1}" core has to be installed for the currently selected "{2}" board. Do you want to install it now?',
96+
candidate.name,
97+
version,
98+
selectedBoard.name
99+
),
100+
manualInstall,
101+
yes
90102
)
91103
.then(async (answer) => {
92104
const index = this.notifications.findIndex((board) =>
@@ -95,7 +107,7 @@ export class BoardsAutoInstaller implements FrontendApplicationContribution {
95107
if (index !== -1) {
96108
this.notifications.splice(index, 1);
97109
}
98-
if (answer === 'Yes') {
110+
if (answer === yes) {
99111
await Installable.installWithProgress({
100112
installable: this.boardsService,
101113
item: candidate,
@@ -105,7 +117,7 @@ export class BoardsAutoInstaller implements FrontendApplicationContribution {
105117
});
106118
return;
107119
}
108-
if (answer === 'Install Manually') {
120+
if (answer === manualInstall) {
109121
this.boardsManagerFrontendContribution
110122
.openView({ reveal: true })
111123
.then((widget) =>

0 commit comments

Comments
 (0)