vscode-nls
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -44,9 +44,23 @@ /* -------------------------------------------------------------------------------------------- | ||
function initializeSettings() { | ||
options = { locale: undefined, languagePackSupport: false, cacheLanguageResolution: true, messageFormat: MessageFormat.bundle }; | ||
options = { locale: undefined, language: undefined, languagePackSupport: false, cacheLanguageResolution: true, messageFormat: MessageFormat.bundle }; | ||
if (isString(process.env.VSCODE_NLS_CONFIG)) { | ||
try { | ||
var vscodeOptions = JSON.parse(process.env.VSCODE_NLS_CONFIG); | ||
var language = void 0; | ||
var locale = void 0; | ||
if (vscodeOptions.availableLanguages) { | ||
var value = vscodeOptions.availableLanguages['*']; | ||
if (isString(value)) { | ||
language = value; | ||
} | ||
} | ||
if (isString(vscodeOptions.locale)) { | ||
options.locale = vscodeOptions.locale.toLowerCase(); | ||
} | ||
if (language === undefined) { | ||
options.language = options.locale; | ||
} | ||
else if (language !== 'en') { | ||
options.language = language; | ||
} | ||
if (isBoolean(vscodeOptions._languagePackSupport)) { | ||
@@ -102,10 +116,10 @@ options.languagePackSupport = vscodeOptions._languagePackSupport; | ||
var arg = args[index]; | ||
var replaced = match; | ||
var replacement = match; | ||
if (typeof arg === 'string') { | ||
replaced = arg; | ||
replacement = arg; | ||
} | ||
else if (typeof arg === 'number' || typeof arg === 'boolean' || arg === void 0 || arg === null) { | ||
replaced = String(arg); | ||
replacement = String(arg); | ||
} | ||
return replaced; | ||
return replacement; | ||
}); | ||
@@ -152,7 +166,7 @@ } | ||
else { | ||
if (isPseudo || !options.locale) { | ||
if (isPseudo || !options.language) { | ||
resolvedLanguage = '.nls.json'; | ||
} | ||
else { | ||
var locale = options.locale; | ||
var locale = options.language; | ||
while (locale) { | ||
@@ -183,5 +197,5 @@ var candidate = '.nls.' + locale + '.json'; | ||
function findInTheBoxBundle(root) { | ||
var locale = options.locale; | ||
while (locale) { | ||
var candidate = path.join(root, "nls.bundle." + locale + ".json"); | ||
var language = options.language; | ||
while (language) { | ||
var candidate = path.join(root, "nls.bundle." + language + ".json"); | ||
if (fs.existsSync(candidate)) { | ||
@@ -191,8 +205,8 @@ return candidate; | ||
else { | ||
var index = locale.lastIndexOf('-'); | ||
var index = language.lastIndexOf('-'); | ||
if (index > 0) { | ||
locale = locale.substring(0, index); | ||
language = language.substring(0, index); | ||
} | ||
else { | ||
locale = undefined; | ||
language = undefined; | ||
} | ||
@@ -202,3 +216,3 @@ } | ||
// Test if we can reslove the default bundle. | ||
if (locale === undefined) { | ||
if (language === undefined) { | ||
var candidate = path.join(root, 'nls.bundle.json'); | ||
@@ -465,2 +479,3 @@ if (fs.existsSync(candidate)) { | ||
options.locale = opts.locale.toLowerCase(); | ||
options.language = options.locale; | ||
resolvedLanguage = undefined; | ||
@@ -467,0 +482,0 @@ resolvedBundles = Object.create(null); |
{ | ||
"name": "vscode-nls", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "NPM module to externalize and localize VSCode extensions", | ||
@@ -5,0 +5,0 @@ "author": "Microsoft Corporation", |
@@ -41,2 +41,6 @@ # vscode-nls | ||
### 4.1.0 | ||
* support language and locale when resolving options from `VSCODE_NLS_CONFIG` setting. | ||
### 4.0.0 | ||
@@ -43,0 +47,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24497
508
65