Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localize Variable Explorer in vscode insiders #2964

Merged
merged 1 commit into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions eng/Localize/LocProject.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
"SourceFile": "src\\polyglot-notebooks-vscode-insiders\\package.nls.json",
"OutputPath": "src\\polyglot-notebooks-vscode-insiders",
"CopyOption": "LangIDOnName"
},
{
"SourceFile": "src\\polyglot-notebooks-vscode-insiders\\l10n\\bundle.l10n.json",
"OutputPath": "src\\polyglot-notebooks-vscode-insiders\\l10n",
"CopyOption": "LangIDOnName"
}
],
"LanguageSet": "VS_Main_Languages"
Expand Down
17 changes: 11 additions & 6 deletions src/polyglot-notebooks-vscode-common/src/variableExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ class WatchWindowTableViewProvider implements vscode.WebviewViewProvider {
if (this.webview) {

const localizationStrings: GridLocalization = {
actionsColumnHeader: 'Actions',
nameColumnHeader: 'Name',
valueColumnHeader: 'Value',
typeColumnHeader: 'Type',
kernelNameColumnHeader: 'Kernel',
shareTemplate: 'Share value {value-name} from {kernel-name} kernel'
actionsColumnHeader: this.translate('VariableGridColumnActions', 'Actions'),
nameColumnHeader: this.translate('VariableGridColumnName', 'Name'),
valueColumnHeader: this.translate('VariableGridColumnValue', 'Value'),
typeColumnHeader: this.translate('VariableGridColumnType', 'Type'),
kernelNameColumnHeader: this.translate('VariableGridColumnKernel', 'Kernel'),
shareTemplate: this.translate('VariableGridshareTemplate', 'Share value {value-name} from {kernel-name} kernel')
};

this.webview.postMessage({
Expand All @@ -168,6 +168,11 @@ class WatchWindowTableViewProvider implements vscode.WebviewViewProvider {
}
}

private translate(key: string, fallback: string): string {
const translation = vscode.l10n.t(key);
return translation === key ? fallback : translation;
}

showNotebookVariables(notebookUri: vscodeLike.Uri | undefined) {
let rows: VariableGridRow[] = [];
if (notebookUri) {
Expand Down
8 changes: 8 additions & 0 deletions src/polyglot-notebooks-vscode-insiders/l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"VariableGridColumnActions": "Actions",
"VariableGridColumnName": "Name",
"VariableGridColumnValue": "Value",
"VariableGridColumnType": "Type",
"VariableGridColumnKernel": "Kernel",
"VariableGridshareTemplate": "Share value {value-name} from {kernel-name} kernel"
}
3 changes: 2 additions & 1 deletion src/polyglot-notebooks-vscode-insiders/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
},
"virtualWorkspaces": true
},
"l10n": "./l10n",
"contributes": {
"notebooks": [
{
Expand Down Expand Up @@ -842,4 +843,4 @@
"vscode-uri": "3.0.6",
"@vscode/l10n": "^0.0.10"
}
}
}