Closed EzioLi01 closed 2 months ago
@EzioLi01 can you tell me how it's failing? I tried adding launchArgs: ["--locale", "zh-cn"],
to my .vscode-test.mjs
file (using vscode-test) and wasn't able to repro. The Stable VS Code that opens is in Chinese.
.vscode-test.mjs
W're using @vscode/test-electron
to setup and run test as below(same as this doc):
Note: Only using test-electron
, no test-cli
and .vscode-test.mjs
file.
try {
const extensionDevelopmentPath = path.resolve(__dirname, "..", "..");
const extensionTestsPath = path.resolve(__dirname, "index");
console.log(extensionTestsPath);
await runTests({
extensionDevelopmentPath,
extensionTestsPath,
launchArgs: ["--locale", "zh-cn"],
version: "insiders",
});
}
Error message is not localized, but it working well on 1.91.0.
Also, I have tried to use test-cli
only with below config:
export default defineConfig({
files: '**/localization.test.js',
launchArgs: ["--locale", "zh-cn"],
version: 'insiders',
});
The issue is still repro both on pipeline and local machine with Windows, MacOS and Linux. Please check it. Thanks!
@EzioLi01 when VS Code opens, can you see that it is in Chinese or is it still in English? I'm not talking about your test in this case, I'm talking about VS Code in general. This will help me understand if it has to do with VS Code applying this locale entirely or just at the extension level.
@EzioLi01 when VS Code opens, can you see that it is in Chinese or is it still in English? I'm not talking about your test in this case, I'm talking about VS Code in general. This will help me understand if it has to do with VS Code applying this locale entirely or just at the extension level.
Yes, the vscode UI is still in English. Sorry for the unclear info, actually I'm not familiar with vscode localization feature.
Our extension internal localized strings are generated and bundled in nls.bundle.<language_id>.json
by vscode-nls-dev
.
According to official doc and with my understanding, vscode UI localization should be related to langPack, but internal message should work well without langPack.
In 1.91, when I open vscode with --locale=zh-cn
, the output log is in Chinese.
But in 1.92 and insiders, it's not working.
👁 , so I can run code-insiders --locale zh-cn
and see the UI be in Chinese, but it requires the associated language extension to be installed. Maybe that extension is not installed here? At least that would explain the english translation for the VS Code core UI.
hey, same thing happens to me too. The extension internal log can be localized without language package before 1.92 in my local. Is there any changes that may cause this from version 1.91.1 to 1.92.0?
👁 , so I can run
code-insiders --locale zh-cn
and see the UI be in Chinese, but it requires the associated language extension to be installed. Maybe that extension is not installed here? At least that would explain the english translation for the VS Code core UI.
Yes, the UI translation should install correct language package, it works well. But extension internal message and log can be localized directly using vscode-nls bundler without language package before 1.92. Need to confirm if it's the expected behavior.
Yes, I was just referring to the question asked in https://github.com/microsoft/vscode/issues/224769#issuecomment-2271935343. My understanding is also that 3rd party extensions are shipping their own translations and thus would not require the VS Code language pack.
With 1.92.0
the NLS story was revamped, however only for core, not impacting extensions. However its possible we have a regression here, maybe only impacting extensions that use vscode-nls-dev
.
@TylerLeonhardt did you try in your sample to reproduce using vscode-nls-dev
specifically?
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.
Happy Coding!
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.
Happy Coding!
Looked into this some more... looks like a regression in what is passed down in the VSCODE_NLS_CONFIG
environment variable.
In 1.91:
"VSCODE_NLS_CONFIG": {
"locale": "ja",
"osLocale": "en-us",
"availableLanguages": {},
"_languagePackSupport": true
}
In 1.92:
"VSCODE_NLS_CONFIG": {
"userLocale": "ja",
"osLocale": "en-us",
"resolvedLanguage": "en",
"defaultMessagesFile": "/Applications/Visual Studio Code.app/Contents/Resources/app/out/nls.messages.json",
"locale": "en",
"availableLanguages": {}
},
This is what happened when I ran tests with --locale ja
.
I didn't repro this with l10n
because that doesn't use this environment variable. Additionally, this doesn't repro if you install the language pack because then this env var becomes:
"VSCODE_NLS_CONFIG": {
"userLocale": "la",
"osLocale": "en-us",
"resolvedLanguage": "la",
"defaultMessagesFile": "/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/nls.messages.json",
"languagePack": {
"translationsConfigFile": "/Users/tyleonha/Library/Application Support/Code - Insiders/clp/52c45b3a0d3f8a9836240c5c89f93e94.la/tcf.json",
"messagesFile": "/Users/tyleonha/Library/Application Support/Code - Insiders/clp/52c45b3a0d3f8a9836240c5c89f93e94.la/e37706186d2105b4158df80574323ebb987d7f64/nls.messages.json",
"corruptMarkerFile": "/Users/tyleonha/Library/Application Support/Code - Insiders/clp/52c45b3a0d3f8a9836240c5c89f93e94.la/corrupted.info"
},
"locale": "la",
"availableLanguages": {
"*": "la"
},
"_languagePackId": "52c45b3a0d3f8a9836240c5c89f93e94.la",
"_languagePackSupport": true,
"_translationsConfigFile": "/Users/tyleonha/Library/Application Support/Code - Insiders/clp/52c45b3a0d3f8a9836240c5c89f93e94.la/tcf.json",
"_cacheRoot": "/Users/tyleonha/Library/Application Support/Code - Insiders/clp/52c45b3a0d3f8a9836240c5c89f93e94.la",
"_resolvedLanguagePackCoreLocation": "/Users/tyleonha/Library/Application Support/Code - Insiders/clp/52c45b3a0d3f8a9836240c5c89f93e94.la/e37706186d2105b4158df80574323ebb987d7f64",
"_corruptedFile": "/Users/tyleonha/Library/Application Support/Code - Insiders/clp/52c45b3a0d3f8a9836240c5c89f93e94.la/corrupted.info"
}
You can see the locale
is set correctly.
I didn't make changes in this space then, which leads me to believe it's the NLS changes you did @bpasero but I need to look closer.
Update: locale issue is fixed on latest insiders.
Version: 1.93.0-insider (user setup) Commit: d1388fd24fc0acf17ae1f759e85c1acf559ed759 Date: 2024-08-28T05:14:36.262Z Electron: 30.4.0 ElectronBuildId: 10073054 Chromium: 124.0.6367.243 Node.js: 20.15.1 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.22631
Thanks so much!!
Hey experts, I'm project owner for microsoft/vscode-react-native, we're using vscode-test for the extension localization testing. The test is running in latest stable version of vscode as below.
runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs: ["--locale", "zh-cn"], version: "stable", });
Recently we found our locale tests is failed in pipeline, the test is working well on vscode 1.91.0, but failed both on 1.92.0 and insiders.
Could you please help to check it? Any info needed please let me know, thank you!