Gathering detailed insights and metrics for vscode-nls
Gathering detailed insights and metrics for vscode-nls
Gathering detailed insights and metrics for vscode-nls
Gathering detailed insights and metrics for vscode-nls
npm module to support externalization and localization of VSCode extensions.
npm install vscode-nls
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
93 Stars
95 Commits
31 Forks
48 Watching
6 Branches
67 Contributors
Updated on 22 Nov 2024
TypeScript (96.64%)
JavaScript (3.36%)
Cumulative downloads
Total Downloads
Last day
-8.2%
249,843
Compared to previous day
Last week
-1.1%
1,439,800
Compared to previous week
Last month
6.4%
6,099,092
Compared to previous month
Last year
44.1%
54,300,308
Compared to previous year
⚠️ This package is no longer receiving new features in favor of the new localization library, vscode-l10n. Please use that collection of libraries instead.
CommonJS module to support externalization and localization. The module only depends on Node.js however its primary use case is for VSCode extensions.
1// This must be the first import in the main entry file 2import * as nls from 'vscode-nls'; 3 4let localize = nls.config({ locale: 'de-DE' })(); 5 6console.log(localize('keyOne', "Hello World")); 7console.log(localize('keyTwo', "Current Date {0}", Date.now()));
The config
call configures the nls module and should only be called once in the applications entry point. You pass in the locale you want to use and whether the resolved locale should be cached for all further calls. The config call returns a function which is used to load a message bundle. During development time the argument should stay empty. There is another tool that helps extracting the message from your sources and it creates the message bundles automatically for you. The tool is available here.
In secondary modules loaded from the 'main' module no configuration is necessary. However you still need to load the nls module and load the message bundle. This looks like this:
1// In secondary file this import can be at random places. 2import * as nls from 'vscode-nls'; 3 4let localize = nls.loadMessageBundle(); 5 6console.log(localize('keyOne', "Hello World"));
During development time the strings in the code are presented to the user. If the locale is set to 'pseudo' the messages are modified in the following form:
nls.config({...})
on web. Context in this PR by @a-stewartvscode-nls\node
. To use the browser specific part import vscode-nls\browser
.The browser specific part currently does only support a default language inline in code. There is no support yet to load a different language bundle during runtime. However the split allows to web pack the vscode-nls
module.
VSCODE_NLS_CONFIG
setting.localize
function to string | number | boolean | null | undefined
nls.bundle(.${locale})?.json
file.No vulnerabilities found.
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
6 existing vulnerabilities detected
Details
Reason
Found 6/23 approved changesets -- score normalized to 2
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