Socket
Socket
Sign inDemoInstall

vscode-nls

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vscode-nls - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

4

lib/main.d.ts
export interface Options {
locale?: string;
cache?: boolean;
cacheLanguageResolution?: boolean;
}

@@ -16,3 +16,3 @@ export interface LocalizeInfo {

}
export declare function load(file?: string): LocalizeFunc;
export declare function loadMessageBundle(file?: string): LocalizeFunc;
export declare function config(options: Options): LoadFunc;

@@ -8,3 +8,3 @@ /* --------------------------------------------------------------------------------------------

var fs = require('fs');
var _options = { locale: 'en-US', cache: false };
var _options = { locale: 'en-US', cacheLanguageResolution: true };
var _isPseudo = false;

@@ -75,3 +75,3 @@ var _resolvedLanguage = null;

var resolvedLanguage;
if (_options.cache && _resolvedLanguage) {
if (_options.cacheLanguageResolution && _resolvedLanguage) {
resolvedLanguage = _resolvedLanguage;

@@ -103,3 +103,3 @@ }

}
if (_options.cache) {
if (_options.cacheLanguageResolution) {
_resolvedLanguage = resolvedLanguage;

@@ -110,3 +110,3 @@ }

}
function load(file) {
function loadMessageBundle(file) {
if (!file) {

@@ -138,3 +138,3 @@ return localize;

}
exports.load = load;
exports.loadMessageBundle = loadMessageBundle;
function config(options) {

@@ -145,9 +145,9 @@ if (isString(options.locale)) {

}
if (isBoolean(options.cache)) {
_options.cache = options.cache;
if (isBoolean(options.cacheLanguageResolution)) {
_options.cacheLanguageResolution = options.cacheLanguageResolution;
}
_isPseudo = _options.locale === 'pseudo';
return load;
return loadMessageBundle;
}
exports.config = config;
//# sourceMappingURL=main.js.map
{
"name": "vscode-nls",
"version": "1.0.1",
"version": "1.0.2",
"description": "NPM module to externalize and localize VSCode extensions",

@@ -5,0 +5,0 @@ "author": "Microsoft Corporation",

@@ -16,3 +16,3 @@ # vscode-nls

let localize = nls.config({ locale: 'de-DE', cache: true })();
let localize = nls.config({ locale: 'de-DE' })();

@@ -23,4 +23,14 @@ console.log(localize('keyOne', "Hello World"));

The `config` call configures the nls module and should only be called once in an application. 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 you sources and create the message bundles autmatically for you. The tools is available [here]().
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 you sources and create the message bundles autmatically for you. The tools 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:
```typescript
import * as nls from 'vscode-nls';
let localize = nls.loadMessageBundle();
console.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:

@@ -27,0 +37,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc