diff --git a/build.ps1 b/build.ps1 index e3fc6c1e6d..444eb6a66d 100644 --- a/build.ps1 +++ b/build.ps1 @@ -37,19 +37,25 @@ if (! $?) Write-Host "`nBuild failed!" -ForegroundColor $errorColor exit 1 } +Write-Host "Creating Localization Files" -ForegroundColor $successColor +npx @vscode/l10n-dev export --outDir ./l10n ./src popd #################### Compile runtime extension #################### pushd vscode-dotnet-runtime-extension + if (Test-Path node_modules) { rm -r -force node_modules } npm ci npm run compile - if (! $?) { Write-Host "`nBuild failed!" -ForegroundColor $errorColor exit 1 } + +Write-Host "Creating Localization Files" -ForegroundColor $successColor +npx @vscode/l10n-dev export --outDir ./l10n ./src + popd #################### Compile SDK extension #################### diff --git a/build.sh b/build.sh index 9e7df6e0e4..872fcfebe8 100755 --- a/build.sh +++ b/build.sh @@ -25,6 +25,7 @@ pushd vscode-dotnet-runtime-library rm -rf node_modules npm ci npm run compile +npx @vscode/l10n-dev export --outDir ./l10n ./src if [ $? -ne 0 ]; then @@ -41,6 +42,7 @@ pushd vscode-dotnet-runtime-extension rm -rf node_modules npm ci npm run compile +npx @vscode/l10n-dev export --outDir ./l10n ./src if [ $? -ne 0 ]; then diff --git a/pipeline-templates/build-test.yaml b/pipeline-templates/build-test.yaml index f2cbdbca5b..a17abecd38 100644 --- a/pipeline-templates/build-test.yaml +++ b/pipeline-templates/build-test.yaml @@ -24,6 +24,8 @@ jobs: artifactName: '${{ parameters.pool.os }} SDK logs' steps: - template: install-node.yaml + - bash: | + npm install -g @vscode/l10n-dev - ${{ if eq(parameters.pool.os, 'windows') }}: - script: build.cmd displayName: πŸ’» Build Windows diff --git a/sample/yarn.lock b/sample/yarn.lock index 0fe3bc1ada..eaf85a9a61 100644 --- a/sample/yarn.lock +++ b/sample/yarn.lock @@ -2207,7 +2207,7 @@ uuid@^8.3.0: fsevents "^2.3.3" "vscode-dotnet-runtime@file:../vscode-dotnet-runtime-extension": - version "2.2.3" + version "2.2.4" resolved "file:../vscode-dotnet-runtime-extension" dependencies: "@types/chai-as-promised" "^7.1.8" diff --git a/vscode-dotnet-runtime-extension/package.json b/vscode-dotnet-runtime-extension/package.json index 00ece59b40..3912fb5708 100644 --- a/vscode-dotnet-runtime-extension/package.json +++ b/vscode-dotnet-runtime-extension/package.json @@ -18,6 +18,7 @@ "engines": { "vscode": "^1.81.1" }, + "l10n": "./l10n", "categories": [ "Other" ], diff --git a/vscode-dotnet-runtime-extension/package.nls.ja.json b/vscode-dotnet-runtime-extension/package.nls.ja.json new file mode 100644 index 0000000000..f35d3300eb --- /dev/null +++ b/vscode-dotnet-runtime-extension/package.nls.ja.json @@ -0,0 +1,3 @@ +{ + "ms-dotnettools.vscode-dotnet-runtime.downloadRequest": "γƒ€γ‚¦γƒ³γƒ­γƒΌγƒ‰γ‚’θ¦ζ±‚γ•γ‚ŒγŸ" +} diff --git a/vscode-dotnet-runtime-extension/package.nls.json b/vscode-dotnet-runtime-extension/package.nls.json new file mode 100644 index 0000000000..7c3ec40fa7 --- /dev/null +++ b/vscode-dotnet-runtime-extension/package.nls.json @@ -0,0 +1,3 @@ +{ + "ms-dotnettools.vscode-dotnet-runtime.downloadRequest": "requested to download" +} diff --git a/vscode-dotnet-runtime-library/l10n/bundle.l10n.json b/vscode-dotnet-runtime-library/l10n/bundle.l10n.json new file mode 100644 index 0000000000..ccbf287fd5 --- /dev/null +++ b/vscode-dotnet-runtime-library/l10n/bundle.l10n.json @@ -0,0 +1,3 @@ +{ + "requested to download": "requested to download" +} \ No newline at end of file diff --git a/vscode-dotnet-runtime-library/package.json b/vscode-dotnet-runtime-library/package.json index eea8a20777..5ef68377c3 100644 --- a/vscode-dotnet-runtime-library/package.json +++ b/vscode-dotnet-runtime-library/package.json @@ -10,6 +10,7 @@ "engines": { "vscode": "^1.74.0" }, + "l10n": "./l10n", "main": "./dist/index.js", "types": "./dist/index.d.ts", "scripts": { diff --git a/vscode-dotnet-runtime-library/package.nls.ja.json b/vscode-dotnet-runtime-library/package.nls.ja.json new file mode 100644 index 0000000000..030039cf75 --- /dev/null +++ b/vscode-dotnet-runtime-library/package.nls.ja.json @@ -0,0 +1,4 @@ +{ + "ms-dotnettools.vscode-dotnet-runtime.downloadRequest": "γƒ€γ‚¦γƒ³γƒ­γƒΌγƒ‰γ‚’θ¦ζ±‚γ•γ‚ŒγŸ", + "ms-dotnettools.vscode-dotnet-runtime.installedExtChange": "ζ‹‘εΌ΅ζ©Ÿθƒ½γ«ε€‰ζ›΄γŒζ€œε‡Ίγ•γ‚ŒγΎγ—γŸγ€‚ζ–°γ—γ„ζ‹‘εΌ΅ζ©Ÿθƒ½η”¨γ« .NET γ‚’γ‚€γƒ³γ‚ΉγƒˆγƒΌγƒ«γ—γΎγ™γ€‚" +} diff --git a/vscode-dotnet-runtime-library/package.nls.json b/vscode-dotnet-runtime-library/package.nls.json new file mode 100644 index 0000000000..b21062e78d --- /dev/null +++ b/vscode-dotnet-runtime-library/package.nls.json @@ -0,0 +1,4 @@ +{ + "ms-dotnettools.vscode-dotnet-runtime.downloadRequest": "requested to download", + "ms-dotnettools.vscode-dotnet-runtime.installedExtChange": "A change was detected in the extensions. Installing .NET for new extensions." +} diff --git a/vscode-dotnet-runtime-library/src/Acquisition/JsonInstaller.ts b/vscode-dotnet-runtime-library/src/Acquisition/JsonInstaller.ts index 7ee6fe7adc..ddf2e89996 100644 --- a/vscode-dotnet-runtime-library/src/Acquisition/JsonInstaller.ts +++ b/vscode-dotnet-runtime-library/src/Acquisition/JsonInstaller.ts @@ -2,7 +2,6 @@ * Licensed to the .NET Foundation under one or more agreements. * The .NET Foundation licenses this file to you under the MIT license. *--------------------------------------------------------------------------------------------*/ - import { IEventStream } from "../EventStream/EventStream"; import { DotnetVSCodeExtensionChange, DotnetVSCodeExtensionFound, DotnetVSCodeExtensionHasInstallRequest } from "../EventStream/EventStreamEvents"; import { IDotnetAcquireContext } from "../IDotnetAcquireContext"; @@ -19,7 +18,7 @@ export class JsonInstaller extends IJsonInstaller // If a new extension is installed, we want to install .NET preemptively for it if specified vscodeAccessor.registerOnExtensionChange(() => { - this.eventStream.post(new DotnetVSCodeExtensionChange(`A change was detected in the extensions. Installing .NET for new extensions.`)); + this.eventStream.post(new DotnetVSCodeExtensionChange(vscodeAccessor.localize(`A change was detected in the extensions. Installing .NET for new extensions.`))); this.executeJSONRequests().catch( () => {}); }) diff --git a/vscode-dotnet-runtime-library/src/EventStream/OutputChannelObserver.ts b/vscode-dotnet-runtime-library/src/EventStream/OutputChannelObserver.ts index a5fa079795..ab90b61bf4 100644 --- a/vscode-dotnet-runtime-library/src/EventStream/OutputChannelObserver.ts +++ b/vscode-dotnet-runtime-library/src/EventStream/OutputChannelObserver.ts @@ -39,7 +39,7 @@ export class OutputChannelObserver implements IEventStreamObserver { this.inProgressDownloads.push(acquisitionStarted.install.installId); - this.outputChannel.append(`${acquisitionStarted.requestingExtensionId} requested to download the ${ + this.outputChannel.append(`${acquisitionStarted.requestingExtensionId} ${vscode.l10n.t('requested to download')} the ${ acquisitionStarted.install.installMode === 'sdk' ? '.NET SDK' : acquisitionStarted.install.installMode === 'runtime' ? '.NET Runtime' : '.NET ASP.NET Runtime' diff --git a/vscode-dotnet-runtime-library/src/IVSCodeExtensionContext.ts b/vscode-dotnet-runtime-library/src/IVSCodeExtensionContext.ts index 8b96f5e14b..8a65aeebe5 100644 --- a/vscode-dotnet-runtime-library/src/IVSCodeExtensionContext.ts +++ b/vscode-dotnet-runtime-library/src/IVSCodeExtensionContext.ts @@ -14,4 +14,6 @@ export abstract class IVSCodeExtensionContext abstract getExtensions() : readonly any[]; abstract executeCommand(command : string, ...args: any[]) : Thenable; + + abstract localize(message: string, ...args: Array): string } diff --git a/vscode-dotnet-runtime-library/src/VSCodeExtensionContext.ts b/vscode-dotnet-runtime-library/src/VSCodeExtensionContext.ts index 1dd585db67..5602e9b6d5 100644 --- a/vscode-dotnet-runtime-library/src/VSCodeExtensionContext.ts +++ b/vscode-dotnet-runtime-library/src/VSCodeExtensionContext.ts @@ -44,4 +44,9 @@ export class VSCodeExtensionContext extends IVSCodeExtensionContext { return vscode.commands.executeCommand(command, ...args); } + + public localize(message: string, ...args: Array): string + { + return vscode.l10n.t(message, ...args); + } } \ No newline at end of file diff --git a/vscode-dotnet-runtime-library/src/test/mocks/MockObjects.ts b/vscode-dotnet-runtime-library/src/test/mocks/MockObjects.ts index cb60f47ef6..67ad271c95 100644 --- a/vscode-dotnet-runtime-library/src/test/mocks/MockObjects.ts +++ b/vscode-dotnet-runtime-library/src/test/mocks/MockObjects.ts @@ -246,6 +246,10 @@ export class MockVSCodeExtensionContext extends IVSCodeExtensionContext setVSCodeEnvironmentVariable(variable: string, value: string): void { // Do nothing. } + + localize(message: string, ...args: Array): string { + return message; + } } export class MockVSCodeEnvironment extends IVSCodeEnvironment