Updated l10n sample

This commit is contained in:
Tyler Leonhardt
2022-11-14 09:57:04 -08:00
parent ddae6c0c9f
commit bbd297d52d
5 changed files with 25 additions and 19 deletions

View File

@ -9,7 +9,7 @@
"version": "0.1.0",
"license": "MIT",
"dependencies": {
"@vscode/l10n": "^0.0.3"
"@vscode/l10n": "^0.0.10"
},
"devDependencies": {
"@types/glob": "^7.2.0",
@ -18,7 +18,7 @@
"@types/vscode": "^1.73.0",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"@vscode/l10n-dev": "0.0.16",
"@vscode/l10n-dev": "^0.0.18",
"@vscode/test-electron": "^2.1.3",
"eslint": "^8.11.0",
"glob": "^7.2.0",
@ -370,14 +370,14 @@
"dev": true
},
"node_modules/@vscode/l10n": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/@vscode/l10n/-/l10n-0.0.3.tgz",
"integrity": "sha512-bd87qMfNUXIb/YgxEE3atkwqICYM6w18gCnCU0qeBiiSriuPPohcPwMGJ8TQ4o3FLCUCUxsi6sP4tpBaiyTXnw=="
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/@vscode/l10n/-/l10n-0.0.10.tgz",
"integrity": "sha512-E1OCmDcDWa0Ya7vtSjp/XfHFGqYJfh+YPC1RkATU71fTac+j1JjCcB3qwSzmlKAighx2WxhLlfhS0RwAN++PFQ=="
},
"node_modules/@vscode/l10n-dev": {
"version": "0.0.16",
"resolved": "https://registry.npmjs.org/@vscode/l10n-dev/-/l10n-dev-0.0.16.tgz",
"integrity": "sha512-TDCx2ARrc9lCzn59q5YiSxs+kkUCDwV0IjCHPo5DvDYHFS+leMBG/kdZuyO5lmMpv3tjhf+4aw8ptwrC999Vjw==",
"version": "0.0.18",
"resolved": "https://registry.npmjs.org/@vscode/l10n-dev/-/l10n-dev-0.0.18.tgz",
"integrity": "sha512-pEKLMnlg7hlxFrZLqcyJe08olmj6KVs2Rof7MVB5rN0D6NOKPBRtkQ176TuMUmW863EDV5WQUgNzOGa2nHBSSQ==",
"dev": true,
"dependencies": {
"deepmerge-json": "^1.5.0",
@ -2872,14 +2872,14 @@
"dev": true
},
"@vscode/l10n": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/@vscode/l10n/-/l10n-0.0.3.tgz",
"integrity": "sha512-bd87qMfNUXIb/YgxEE3atkwqICYM6w18gCnCU0qeBiiSriuPPohcPwMGJ8TQ4o3FLCUCUxsi6sP4tpBaiyTXnw=="
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/@vscode/l10n/-/l10n-0.0.10.tgz",
"integrity": "sha512-E1OCmDcDWa0Ya7vtSjp/XfHFGqYJfh+YPC1RkATU71fTac+j1JjCcB3qwSzmlKAighx2WxhLlfhS0RwAN++PFQ=="
},
"@vscode/l10n-dev": {
"version": "0.0.16",
"resolved": "https://registry.npmjs.org/@vscode/l10n-dev/-/l10n-dev-0.0.16.tgz",
"integrity": "sha512-TDCx2ARrc9lCzn59q5YiSxs+kkUCDwV0IjCHPo5DvDYHFS+leMBG/kdZuyO5lmMpv3tjhf+4aw8ptwrC999Vjw==",
"version": "0.0.18",
"resolved": "https://registry.npmjs.org/@vscode/l10n-dev/-/l10n-dev-0.0.18.tgz",
"integrity": "sha512-pEKLMnlg7hlxFrZLqcyJe08olmj6KVs2Rof7MVB5rN0D6NOKPBRtkQ176TuMUmW863EDV5WQUgNzOGa2nHBSSQ==",
"dev": true,
"requires": {
"deepmerge-json": "^1.5.0",

View File

@ -52,9 +52,9 @@
"mocha": "^9.2.2",
"typescript": "^4.5.5",
"@vscode/test-electron": "^2.1.3",
"@vscode/l10n-dev": "0.0.16"
"@vscode/l10n-dev": "^0.0.18"
},
"dependencies": {
"@vscode/l10n": "^0.0.3"
"@vscode/l10n": "^0.0.10"
}
}

View File

@ -1,8 +1,8 @@
import * as l10n from '@vscode/l10n';
if (process.env['EXTENSION_BUNDLE_URI']) {
if (process.env['EXTENSION_BUNDLE_PATH']) {
l10n.config({
uri: process.env['EXTENSION_BUNDLE_URI']
fsPath: process.env['EXTENSION_BUNDLE_PATH']
});
}

View File

@ -7,4 +7,10 @@ import { l10n, window } from 'vscode';
export function sayByeCommand() {
const message = l10n.t('Bye');
window.showInformationMessage(message);
const message2 = l10n.t({
message: 'Bye {0}',
args: ['Joey'],
comment: ['{0} is a person\'s name']
});
window.showInformationMessage(message2);
}

View File

@ -21,7 +21,7 @@ export function activate(context: vscode.ExtensionContext) {
message,
new vscode.ShellExecution(`node ${path.join(__dirname, 'cli.js')}`, {
// eslint-disable-next-line @typescript-eslint/naming-convention
env: vscode.l10n.uri ? { EXTENSION_BUNDLE_URI: vscode.l10n.uri?.toString(true) } : undefined
env: vscode.l10n.uri ? { EXTENSION_BUNDLE_PATH: vscode.l10n.uri?.fsPath } : undefined
})));
const messageDone = vscode.l10n.t('Hello {done}', { done: 'FINISHED' });