Gathering detailed insights and metrics for vscode-nls-dev
Gathering detailed insights and metrics for vscode-nls-dev
Gathering detailed insights and metrics for vscode-nls-dev
Gathering detailed insights and metrics for vscode-nls-dev
npm install vscode-nls-dev
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
40 Stars
149 Commits
37 Forks
48 Watching
4 Branches
68 Contributors
Updated on 22 Nov 2024
TypeScript (93.73%)
JavaScript (6.27%)
Cumulative downloads
Total Downloads
Last day
-27.2%
2,697
Compared to previous day
Last week
-4.9%
13,215
Compared to previous week
Last month
-5.8%
62,778
Compared to previous month
Last year
28.3%
607,372
Compared to previous year
12
⚠️ This package is no longer receiving new features in favor of the new localization library, vscode-l10n. Please use that collection of libraries instead.
The tools automates the extraction of strings to be externalized from TS and JS code. It therefore helps localizing VSCode extensions and language servers written in TS and JS. It also contains helper methods to convert unlocalized JSON to XLIFF format for translations, and back to localized JSON files, with ability to push and pull localizations from Transifex platform.
nls.bundle(.${locale})?.json
file.To perform unlocalized JSON to XLIFF conversion it is required to call prepareXlfFiles(projectName, extensionName)
piping your extension/language server directory to it, where projectName
is the Transifex project name (if such exists) and extensionName
is the name of your extension/language server. Thereby, XLF files will have a path of projectName/extensionName.xlf
.
To convert translated XLIFF to localized JSON files prepareJsonFiles()
should be called, piping .xlf
files to it. It will parse translated XLIFF to JSON files, reconstructed under original file paths.
Updating Transifex with latest unlocalized strings is done via pushXlfFiles('www.transifex.com', apiName, apiToken)
and pullXlfFiles('www.transifex.com', apiName, apiToken, languages, resources)
for pulling localizations respectively. When pulling, you have to provide resources
array with object literals that have name
and project
properties. name
corresponds to the resource name in Transifex and project
is a project name of your Transifex project where this resource is stored. languages
argument is an array of strings of culture names to be pulled from Transifex.
Here is a sample code that adds localization using Transifex. You can copy and use it as a template for your own extension, changing the values to the ones described in the code comments.
1var nls = require('vscode-nls-dev'); 2const vscodeLanguages = [ 3 'zh-hans', 4 'zh-hant', 5 'ja', 6 'ko', 7 'de', 8 'fr', 9 'es', 10 'ru', 11 'it' 12]; // languages an extension has to be translated to 13 14const transifexApiHostname = 'www.transifex.com'; 15const transifexApiName = 'api'; 16const transifexApiToken = process.env.TRANSIFEX_API_TOKEN; // token to talk to Transifex (to obtain it see https://docs.transifex.com/api/introduction#authentication) 17const transifexProjectName = 'vscode-extensions'; // your project name in Transifex 18const transifexExtensionName = 'vscode-node-debug'; // your resource name in Transifex 19 20gulp.task('transifex-push', function() { 21 return gulp.src('**/*.nls.json') 22 .pipe(nls.prepareXlfFiles(transifexProjectName, transifexExtensionName)) 23 .pipe(nls.pushXlfFiles(transifexApiHostname, transifexApiName, transifexApiToken)); 24}); 25 26gulp.task('transifex-pull', function() { 27 return nls.pullXlfFiles(transifexApiHostname, transifexApiName, transifexApiToken, vscodeLanguages, [{ name: transifexExtensionName, project: transifexProjectName }]) 28 .pipe(gulp.dest(`../${transifexExtensionName}-localization`)); 29}); 30 31gulp.task('i18n-import', function() { 32 return gulp.src(`../${transifexExtensionName}-localization/**/*.xlf`) 33 .pipe(nls.prepareJsonFiles()) 34 .pipe(gulp.dest('./i18n')); 35});
To push strings for translation to Transifex you call gulp transifex-push
. To pull and perform the import of latest translations from Transifex to your extension, you need to call transifex-pull
and i18n-import
sequentially. This will pull XLF files from Transifex in first gulp task, and import them to i18n folder in JSON format.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
5 existing vulnerabilities detected
Details
Reason
Found 6/20 approved changesets -- score normalized to 3
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More