-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Localization doesn't work #92
Comments
I noticed that localize('key', 'stringValue') are transformed to localize(0, null) in extension.js if I debug start from "${workspaceRoot}/node_modules/gulp/bin/gulp.js". extension.js generated by debug: extension.js generated by executing command "gulp package": |
@Brighttll yes, if the localize calls don't get replace localization doesn't work. But I don't know why this fails with the package task. It does work with the build task :-) |
I know why: the For an extension you can simply do since version 3.x of the vscode-nls module:
which auto configures the NLS. You can also checkout the lsp-sample we have here: https://github.com/Microsoft/vscode-extension-samples/tree/master/i18n-sample |
@dbaeumer Thank you very much. Another question, the second argument of localize call must be a string literal, but I saved the text with default language(en) in a JSON file, is there any other way to load the default language text from JSON file to localize? Thanks again! var commandText = require('../../i18n/en/out/extension.i18n.json'); |
Not sure I understand you. There is not need for you to load localization files by hand. |
The second argument of localize is the default local text, I have to pass a exact string value for it. |
If the second argument is different as the default local text in the localization file, it will display the second argument value, not the text defined in the localization file. |
@dbaeumer Never mind, I missed something. Thank you! |
I tried to localize a message which should displays in ja(Japanese), but the message shows in en(English) after updating the locale as 'ja'. I noticed that localize('key', 'stringValue') are not transformed to localize(0, null) in extension.js after executing command gulp package. But the file extension.nls.ja.json would be generated correctly in the out folder.
I cannot figure out what's going on, did I missed anything?
I attached the source code, the reproduce steps are followings, you can refer the page [https://github.com/Brighttll/vscode-extension-samples/tree/master/i18n-sample] for details.
Much appreciate if any one have a change to have a look at the issue.
Extension.zip
The text was updated successfully, but these errors were encountered: