Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Centralize localization strings #36

Closed
HuihuiWu-Microsoft opened this issue Jun 18, 2021 · 4 comments
Closed

Centralize localization strings #36

HuihuiWu-Microsoft opened this issue Jun 18, 2021 · 4 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@HuihuiWu-Microsoft
Copy link

Currently vscode-nls library is provided for VSC extension localization. But according to current design 1> the localized strings for each languages under i18n are in separated files as a mirror of source code directory and file levels. 2> the English version string is passed to localize() function as second parameter. For microsoft/vscode#1, can you provide a way to make all the localized strings in a single file for better and clearer checking. For microsoft/vscode#2, with all the English version strings embedded in code, It would be hard to track all the Eng strings, how can I make it in a single file and reference from this file?

@dbaeumer dbaeumer transferred this issue from microsoft/vscode Jun 21, 2021
@dbaeumer
Copy link
Member

For extensions there is a vscode-nls-dev package that helps with managing the files. This has support as well to bundle all strings into one file. See https://github.com/microsoft/vscode-nls/blob/main/src/common/common.ts#L8.

The vscode-nls-dev package also generates a single meta data file containing all English strings and their corresponding keys. The file is called nls.metadata.json.

@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label Jun 21, 2021
@HuihuiWu-Microsoft
Copy link
Author

HuihuiWu-Microsoft commented Jun 21, 2021

@dbaeumer Thanks for your response. I think vscode-nls-dev is to transform all files under i18n folder to meta data file under 'out' file. So according to my understanding, the meta data file is only for running the extension after building the extension. But the strings under i18n folder which is like the source to manage is still distributed in different files. For example, when you add a new string in code, you need to add it to i18n folder and when bug exist, you need to find in all these files under the locale folder.

Same to the English strings, the meta data file contains all English strings but it's generated by vscode-nls-dev, the original English word is somehow hardcoded in code instead of referenced from a single file.

@dbaeumer
Copy link
Member

@HuihuiWu-Microsoft as I said in my previous post you can either have single files or one bundle (https://github.com/microsoft/vscode-nls/blob/main/src/common/common.ts#L8.)

vscode-nls-dev extracts strings from the source and generates English files to be translated. vscode-nls allows to use different languages during runtime.

@dbaeumer
Copy link
Member

dbaeumer commented Nov 8, 2021

Without the additional information we can't work on this issue. Please ping when the information is available and we will reopen the issue.

Happy Coding

@dbaeumer dbaeumer closed this as completed Nov 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants