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

Argument 'locale' is not working on 1.92.0 and insiders #224769

Closed
EzioLi01 opened this issue Aug 5, 2024 · 14 comments
Closed

Argument 'locale' is not working on 1.92.0 and insiders #224769

EzioLi01 opened this issue Aug 5, 2024 · 14 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug nls Issues related to NLS processing (not translation issues) verified Verification succeeded
Milestone

Comments

@EzioLi01
Copy link

EzioLi01 commented Aug 5, 2024

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!

@TylerLeonhardt
Copy link
Member

@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.

@TylerLeonhardt TylerLeonhardt added the info-needed Issue requires more information from poster label Aug 5, 2024
@EzioLi01
Copy link
Author

EzioLi01 commented Aug 6, 2024

.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.
Screenshot 2024-08-06 at 10 03 12

@EzioLi01
Copy link
Author

EzioLi01 commented Aug 6, 2024

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!

@TylerLeonhardt
Copy link
Member

@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
Copy link
Author

EzioLi01 commented Aug 7, 2024

@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.
Screenshot 2024-08-07 at 14 56 59

But in 1.92 and insiders, it's not working.
Screenshot 2024-08-07 at 14 57 50

@bpasero
Copy link
Member

bpasero commented Aug 7, 2024

👁 , 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.

@lexie011
Copy link

lexie011 commented Aug 8, 2024

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?

@EzioLi01
Copy link
Author

EzioLi01 commented Aug 8, 2024

👁 , 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.

@bpasero
Copy link
Member

bpasero commented Aug 8, 2024

Yes, I was just referring to the question asked in #224769 (comment). 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?

@bpasero bpasero self-assigned this Aug 8, 2024
@bpasero bpasero added nls Issues related to NLS processing (not translation issues) confirmation-pending and removed triage-needed labels Aug 8, 2024
Copy link

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!

@vs-code-engineering vs-code-engineering bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 15, 2024
Copy link

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!

@vs-code-engineering vs-code-engineering bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 23, 2024
@bpasero bpasero removed their assignment Aug 23, 2024
@TylerLeonhardt
Copy link
Member

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.

@EzioLi01
Copy link
Author

EzioLi01 commented Aug 29, 2024

Update: locale issue is fixed on latest insiders.

Version: 1.93.0-insider (user setup)
Commit: d1388fd
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

@bpasero
Copy link
Member

bpasero commented Aug 29, 2024

Thanks so much!!

@bpasero bpasero closed this as completed Aug 29, 2024
@bpasero bpasero self-assigned this Aug 29, 2024
@bpasero bpasero added this to the August 2024 milestone Aug 29, 2024
@bpasero bpasero added bug Issue identified by VS Code Team member as probable bug verified Verification succeeded and removed info-needed Issue requires more information from poster confirmation-pending labels Aug 29, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Oct 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug nls Issues related to NLS processing (not translation issues) verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants