vscode-nls | npm module to support externalization | Internationalization library
kandi X-RAY | vscode-nls Summary
kandi X-RAY | vscode-nls Summary
npm module to support externalization and localization of VSCode extensions.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of vscode-nls
vscode-nls Key Features
vscode-nls Examples and Code Snippets
Community Discussions
Trending Discussions on vscode-nls
QUESTION
I am trying to understand the workflow presented in https://github.com/microsoft/vscode-extension-samples/tree/master/i18n-sample for localizing Visual Studio Code extensions.
I cannot figure out how the i18n directory gets created to begin with, as well as how the set of string keys in that directory get maintained over time.
There is one line in the README.md which says "You could have created this folder by hand, or you could have used the vscode-nls-dev tool to extract it."...how would one use vscode-nls-dev tool to extract it?
What I Understand
I understand that you can use vscode-nls
, and wrap strings like this: localize("some.key", "My String")
to pick up the localized version of that string at runtime.
I am pretty sure I understand that vscode-nls-dev
is used at build time to substitute the content of files in the i18n
directory into the transpiled JavaScript code, as well as creating files like out/extension.nls.ja.json
What is missing
Surely it is not expected that: for every file.ts
file in your project you create an i18n/lang/out/file.i18n.json
for every lang you support...and then keep the set of keys in that file up to date manually with every string change.
I am assuming that there is some process which automatically goes "are there any localize("key", "String")
calls in file.ts for new keys not yet in file.i18n.json? If so, add those keys with some untranslated values". What is that process?
ANSWER
Answered 2019-Oct-08 at 23:58I have figured this out, referencing https://github.com/Microsoft/vscode-extension-samples/issues/74
This is built to work if you use Transifex for your translator. At the bare minimum you need to use .xlf
files as your translation file format.
I think that this is best illustrated with an example, so lets say you wanted to get the sample project working after you had deleted the i18n folder
- Step 1: Clone that project, and delete the i18n directory
- Step 2: Modify the gulp file so that the
compile
function also generates nls metadata files in theout
directory. Something like:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install vscode-nls
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page