Skip to content

Commit 63582a5

Browse files
committed
Localize message box messages and titles
1 parent 4e031b7 commit 63582a5

File tree

10 files changed

+73
-27
lines changed

10 files changed

+73
-27
lines changed

l10n/bundle.l10n.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"How to setup Remote Debugging": "How to setup Remote Debugging",
3+
"The C# extension for Visual Studio Code is incompatible on {0} {1} with the VS Code Remote Extensions. To see avaliable workarounds, click on '{2}'.": "The C# extension for Visual Studio Code is incompatible on {0} {1} with the VS Code Remote Extensions. To see avaliable workarounds, click on '{2}'.",
4+
"The C# extension for Visual Studio Code is incompatible on {0} {1}.": "The C# extension for Visual Studio Code is incompatible on {0} {1}.",
25
"Cannot create .NET debug configurations. No workspace folder was selected.": "Cannot create .NET debug configurations. No workspace folder was selected.",
36
"Cannot create .NET debug configurations. The server is still initializing or has exited unexpectedly.": "Cannot create .NET debug configurations. The server is still initializing or has exited unexpectedly.",
47
"Cannot create .NET debug configurations. The active C# project is not within folder '{0}'.": "Cannot create .NET debug configurations. The active C# project is not within folder '{0}'.",
@@ -125,20 +128,32 @@
125128
"View Debug Docs": "View Debug Docs",
126129
"Ignore": "Ignore",
127130
"Run and Debug: A valid browser is not installed. Please install Edge or Chrome.": "Run and Debug: A valid browser is not installed. Please install Edge or Chrome.",
131+
"OmniSharp requires a complete install of Mono (including MSBuild) to provide language services when `omnisharp.useModernNet` is disabled in Settings. Please install the latest Mono and restart.": "OmniSharp requires a complete install of Mono (including MSBuild) to provide language services when `omnisharp.useModernNet` is disabled in Settings. Please install the latest Mono and restart.",
132+
"Download Mono": "Download Mono",
133+
"Open settings": "Open settings",
128134
"dotnet.server.useOmnisharp option has changed. Please reload the window to apply the change": "dotnet.server.useOmnisharp option has changed. Please reload the window to apply the change",
129135
"Reload Window": "Reload Window",
130136
"C# configuration has changed. Would you like to relaunch the Language Server with your changes?": "C# configuration has changed. Would you like to relaunch the Language Server with your changes?",
131137
"Restart Language Server": "Restart Language Server",
138+
"project.json is no longer a supported project format for .NET Core applications.": "project.json is no longer a supported project format for .NET Core applications.",
139+
"More Detail": "More Detail",
140+
"Some projects have trouble loading. Please review the output for more details.": "Some projects have trouble loading. Please review the output for more details.",
141+
"There are unresolved dependencies. Please execute the restore command to continue.": "There are unresolved dependencies. Please execute the restore command to continue.",
142+
"Restore": "Restore",
143+
"Package {0} download from {1} failed integrity check. Some features may not work as expected. Please restart Visual Studio Code to retrigger the download": "Package {0} download from {1} failed integrity check. Some features may not work as expected. Please restart Visual Studio Code to retrigger the download",
144+
"Failed to run test: {0}": "Failed to run test: {0}",
145+
"Failed to start debugger: {0}": "Failed to start debugger: {0}",
146+
"Test run already in progress": "Test run already in progress",
132147
"Your workspace has multiple Visual Studio Solution files; please select one to get full IntelliSense.": "Your workspace has multiple Visual Studio Solution files; please select one to get full IntelliSense.",
133148
"Choose": "Choose",
134149
"Choose and set default": "Choose and set default",
135150
"Do not load any": "Do not load any",
151+
"Detected change in telemetry settings. These will not take effect until the language server is restarted, would you like to restart?": "Detected change in telemetry settings. These will not take effect until the language server is restarted, would you like to restart?",
136152
"IntelliCode features will not be available, {0} failed to activate.": "IntelliCode features will not be available, {0} failed to activate.",
137153
"Go to output": "Go to output",
138154
"Suppress notification": "Suppress notification",
139155
"Restore {0}": "Restore {0}",
140156
"Restore already in progress": "Restore already in progress",
141-
"Restore": "Restore",
142157
"Sending request": "Sending request",
143158
"C# configuration has changed. Would you like to reload the window to apply your changes?": "C# configuration has changed. Would you like to reload the window to apply your changes?",
144159
"Nested Code Action": "Nested Code Action",
@@ -154,6 +169,9 @@
154169
"Transport attach could not obtain processes list.": "Transport attach could not obtain processes list.",
155170
"Error Message: ": "Error Message: ",
156171
"See {0} output": "See {0} output",
172+
"Text editor must be focused to fix all issues": "Text editor must be focused to fix all issues",
173+
"Fix all issues": "Fix all issues",
174+
"Select fix all action": "Select fix all action",
157175
"Failed to set extension directory": "Failed to set extension directory",
158176
"Failed to set debugadpter directory": "Failed to set debugadpter directory",
159177
"Failed to set install complete file path": "Failed to set install complete file path",

src/features/fixAllProvider.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,29 +63,30 @@ export class OmniSharpFixAllProvider extends AbstractProvider implements vscode.
6363
private async fixAllMenu(server: OmniSharpServer, scope: protocol.FixAllScope): Promise<void> {
6464
const fileName = vscode.window.activeTextEditor?.document.fileName;
6565
if (fileName === undefined) {
66-
vscode.window.showWarningMessage('Text editor must be focused to fix all issues');
66+
vscode.window.showWarningMessage(vscode.l10n.t('Text editor must be focused to fix all issues'));
6767
return;
6868
}
6969

7070
const availableFixes = await serverUtils.getFixAll(server, { FileName: fileName, Scope: scope });
7171

7272
let targets = availableFixes.Items.map((x) => `${x.Id}: ${x.Message}`);
7373

74+
const fixAllItem = vscode.l10n.t('Fix all issues');
7475
if (scope === protocol.FixAllScope.Document) {
75-
targets = ['Fix all issues', ...targets];
76+
targets = [fixAllItem, ...targets];
7677
}
7778

7879
const action = await vscode.window.showQuickPick(targets, {
7980
matchOnDescription: true,
80-
placeHolder: `Select fix all action`,
81+
placeHolder: vscode.l10n.t(`Select fix all action`),
8182
});
8283

8384
if (action === undefined) {
8485
return;
8586
}
8687

8788
let filter: FixAllItem[] | undefined;
88-
if (action !== 'Fix all issues') {
89+
if (action !== fixAllItem) {
8990
const actionTokens = action.split(':');
9091
filter = [{ Id: actionTokens[0], Message: actionTokens[1] }];
9192
}

src/lsptoolshost/roslynLanguageServer.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -813,10 +813,11 @@ export class RoslynLanguageServer {
813813
// Subscribe to telemetry events so we can enable/disable as needed
814814
this._languageClient.addDisposable(
815815
vscode.env.onDidChangeTelemetryEnabled((_: boolean) => {
816-
const title = 'Restart Language Server';
816+
const title = vscode.l10n.t('Restart Language Server');
817817
const command = 'dotnet.restartServer';
818-
const message =
819-
'Detected change in telemetry settings. These will not take effect until the language server is restarted, would you like to restart?';
818+
const message = vscode.l10n.t(
819+
'Detected change in telemetry settings. These will not take effect until the language server is restarted, would you like to restart?'
820+
);
820821
ShowInformationMessage(vscode, message, { title, command });
821822
})
822823
);

src/lsptoolshost/unitTesting.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ async function runTests(
6868
dotnetTestChannel: vscode.OutputChannel
6969
): Promise<TestProgress | undefined> {
7070
if (_testRunInProgress) {
71-
vscode.window.showErrorMessage('Test run already in progress');
71+
vscode.window.showErrorMessage(vscode.l10n.t('Test run already in progress'));
7272
return;
7373
}
7474

src/main.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,15 @@ export async function activate(
285285
}
286286

287287
if (!isSupportedPlatform(platformInfo)) {
288-
let errorMessage = `The C# extension for Visual Studio Code is incompatible on ${platformInfo.platform} ${platformInfo.architecture}`;
289-
290288
// Check to see if VS Code is running remotely
291289
if (context.extension.extensionKind === vscode.ExtensionKind.Workspace) {
292-
const setupButton = 'How to setup Remote Debugging';
293-
errorMessage += ` with the VS Code Remote Extensions. To see avaliable workarounds, click on '${setupButton}'.`;
290+
const setupButton = vscode.l10n.t('How to setup Remote Debugging');
291+
const errorMessage = vscode.l10n.t(
292+
`The C# extension for Visual Studio Code is incompatible on {0} {1} with the VS Code Remote Extensions. To see avaliable workarounds, click on '{2}'.`,
293+
platformInfo.platform,
294+
platformInfo.architecture,
295+
setupButton
296+
);
294297

295298
await vscode.window.showErrorMessage(errorMessage, setupButton).then((selectedItem) => {
296299
if (selectedItem === setupButton) {
@@ -300,6 +303,11 @@ export async function activate(
300303
}
301304
});
302305
} else {
306+
const errorMessage = vscode.l10n.t(
307+
'The C# extension for Visual Studio Code is incompatible on {0} {1}.',
308+
platformInfo.platform,
309+
platformInfo.architecture
310+
);
303311
await vscode.window.showErrorMessage(errorMessage);
304312
}
305313

src/observers/errorMessageObserver.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
import { vscode } from '../vscodeAdapter';
1414
import showErrorMessage from './utils/showErrorMessage';
1515
import { EventType } from '../omnisharp/eventType';
16+
import { l10n } from 'vscode';
1617

1718
export class ErrorMessageObserver {
1819
constructor(private vscode: vscode) {}
@@ -37,7 +38,11 @@ export class ErrorMessageObserver {
3738
if (!event.retry) {
3839
showErrorMessage(
3940
this.vscode,
40-
`Package ${event.packageDescription} download from ${event.url} failed integrity check. Some features may not work as expected. Please restart Visual Studio Code to retrigger the download`
41+
l10n.t(
42+
`Package {0} download from {1} failed integrity check. Some features may not work as expected. Please restart Visual Studio Code to retrigger the download`,
43+
event.packageDescription,
44+
event.url
45+
)
4146
);
4247
}
4348
}
@@ -47,10 +52,10 @@ export class ErrorMessageObserver {
4752
}
4853

4954
private handleDotnetTestRunFailure(event: DotNetTestRunFailure) {
50-
showErrorMessage(this.vscode, `Failed to run test because ${event.message}.`);
55+
showErrorMessage(this.vscode, l10n.t(`Failed to run test: {0}`, event.message));
5156
}
5257

5358
private handleDotNetTestDebugStartFailure(event: DotNetTestDebugStartFailure) {
54-
showErrorMessage(this.vscode, `Failed to start debugger: ${event.message}`);
59+
showErrorMessage(this.vscode, l10n.t(`Failed to start debugger: {0}`, event.message));
5560
}
5661
}

src/observers/informationMessageObserver.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { vscode } from '../vscodeAdapter';
88
import showInformationMessage from '../shared/observers/utils/showInformationMessage';
99
import { EventType } from '../omnisharp/eventType';
1010
import { omnisharpOptions } from '../shared/options';
11+
import { l10n } from 'vscode';
1112

1213
export class InformationMessageObserver {
1314
constructor(private vscode: vscode) {}
@@ -23,8 +24,13 @@ export class InformationMessageObserver {
2324
private async handleOmnisharpServerUnresolvedDependencies() {
2425
//to do: determine if we need the unresolved dependencies message
2526
if (!omnisharpOptions.suppressDotnetRestoreNotification) {
26-
const message = `There are unresolved dependencies. Please execute the restore command to continue.`;
27-
return showInformationMessage(this.vscode, message, { title: 'Restore', command: 'dotnet.restore.all' });
27+
const message = l10n.t(
28+
`There are unresolved dependencies. Please execute the restore command to continue.`
29+
);
30+
return showInformationMessage(this.vscode, message, {
31+
title: l10n.t('Restore'),
32+
command: 'dotnet.restore.all',
33+
});
2834
}
2935
}
3036
}

src/observers/warningMessageObserver.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ import { Scheduler, Subject } from 'rxjs';
1010

1111
import showWarningMessage from './utils/showWarningMessage';
1212
import { EventType } from '../omnisharp/eventType';
13+
import { l10n } from 'vscode';
1314

1415
export class WarningMessageObserver {
1516
private warningMessageDebouncer: Subject<BaseEvent>;
1617

1718
constructor(private vscode: vscode, private disableMsBuildDiagnosticWarning: () => boolean, scheduler?: Scheduler) {
1819
this.warningMessageDebouncer = new Subject<BaseEvent>();
1920
this.warningMessageDebouncer.pipe(debounceTime(1500, scheduler)).subscribe(async (_) => {
20-
const message = 'Some projects have trouble loading. Please review the output for more details.';
21-
await showWarningMessage(this.vscode, message, { title: 'Show Output', command: 'o.showOutput' });
21+
const message = l10n.t('Some projects have trouble loading. Please review the output for more details.');
22+
await showWarningMessage(this.vscode, message, { title: l10n.t('Show Output'), command: 'o.showOutput' });
2223
});
2324
}
2425

src/omnisharp/extension.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ export async function activate(
108108
server.onServerStart(() => {
109109
utils.requestWorkspaceInformation(server).then((workspaceInfo) => {
110110
if (workspaceInfo.DotNet && workspaceInfo.DotNet.Projects.length > 0) {
111-
const shortMessage =
112-
'project.json is no longer a supported project format for .NET Core applications.';
113-
const moreDetailItem: vscode.MessageItem = { title: 'More Detail' };
111+
const shortMessage = vscode.l10n.t(
112+
'project.json is no longer a supported project format for .NET Core applications.'
113+
);
114+
const moreDetailItem: vscode.MessageItem = { title: vscode.l10n.t('More Detail') };
114115
vscode.window.showWarningMessage(shortMessage, moreDetailItem).then((_) => {
115116
eventStream.post(new ProjectJsonDeprecatedWarning());
116117
});

src/omnisharp/requirementCheck.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,18 @@ async function promptToDownloadDotNetSDK() {
116116

117117
async function promptToDownloadMono() {
118118
return new Promise<PromptResult>((resolve, _) => {
119-
const message =
120-
'OmniSharp requires a complete install of Mono (including MSBuild) to provide language services when `omnisharp.useModernNet` is disabled in Settings. Please install the latest Mono and restart.';
119+
const message = vscode.l10n.t(
120+
'OmniSharp requires a complete install of Mono (including MSBuild) to provide language services when `omnisharp.useModernNet` is disabled in Settings. Please install the latest Mono and restart.'
121+
);
121122

122123
const messageOptions: vscode.MessageOptions = { modal: true };
123124

124-
const yesItem: PromptItem = { title: 'Download Mono', result: PromptResult.Yes };
125-
const noItem: PromptItem = { title: 'Open settings', result: PromptResult.No, isCloseAffordance: true };
125+
const yesItem: PromptItem = { title: vscode.l10n.t('Download Mono'), result: PromptResult.Yes };
126+
const noItem: PromptItem = {
127+
title: vscode.l10n.t('Open settings'),
128+
result: PromptResult.No,
129+
isCloseAffordance: true,
130+
};
126131

127132
vscode.window
128133
.showErrorMessage(message, messageOptions, noItem, yesItem)

0 commit comments

Comments
 (0)