appcd-response
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -0,1 +1,7 @@ | ||
# v1.1.6 (Mar 29, 2019) | ||
* Fixed bug where exception was being thrown if locale command was not found. | ||
* Added 'force' flag when detecting the locale. | ||
* Updated dependencies. | ||
# v1.1.5 (Jan 16, 2019) | ||
@@ -2,0 +8,0 @@ |
@@ -12,2 +12,7 @@ "use strict"; | ||
/** | ||
* The cached locale value. | ||
* | ||
* @type {?String} | ||
*/ | ||
let cachedLocale; | ||
@@ -17,22 +22,28 @@ /** | ||
* | ||
* @param {Boolean} [force=false] - When `true`, it will bypass the cached locale and redetect. | ||
* @returns {Promise<String>} | ||
*/ | ||
async function locale() { | ||
if (cachedLocale !== undefined) { | ||
async function locale(force) { | ||
if (!force && cachedLocale !== undefined) { | ||
return cachedLocale; | ||
} | ||
if (process.platform === 'win32') { | ||
let value = await (0, _appcdWinreg.get)('HKCU', 'Control Panel\\International', 'Locale'); | ||
try { | ||
if (process.platform === 'win32') { | ||
let value = await (0, _appcdWinreg.get)('HKCU', 'Control Panel\\International', 'Locale'); | ||
if (value) { | ||
value = value.substring(value.length - 4, value.length); | ||
const locale = await (0, _appcdWinreg.get)('HKLM', 'SOFTWARE\\Classes\\MIME\\Database\\Rfc1766', value); | ||
const m = locale.match(/([^;,\n]+?);/); | ||
if (value) { | ||
value = value.substring(value.length - 4, value.length); | ||
const locale = await (0, _appcdWinreg.get)('HKLM', 'SOFTWARE\\Classes\\MIME\\Database\\Rfc1766', value); | ||
const m = locale.match(/([^;,\n]+?);/); | ||
cachedLocale = m ? m[1].replace(/_/g, '-') : null; | ||
} | ||
} else { | ||
const m = (0, _child_process.spawnSync)('locale').stdout.toString().match(/^LANG="?([^".\s]+)/); | ||
cachedLocale = m ? m[1].replace(/_/g, '-') : null; | ||
} | ||
} else { | ||
const m = (0, _child_process.spawnSync)('locale').stdout.toString().match(/^LANG="?([^".\s]+)/); | ||
cachedLocale = m ? m[1].replace(/_/g, '-') : null; | ||
} catch (e) { | ||
// this can happen if the 'locale' command is not found in the system path | ||
cachedLocale = null; | ||
} | ||
@@ -42,2 +53,2 @@ | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxvY2FsZS5qcyJdLCJuYW1lcyI6WyJjYWNoZWRMb2NhbGUiLCJsb2NhbGUiLCJ1bmRlZmluZWQiLCJwcm9jZXNzIiwicGxhdGZvcm0iLCJ2YWx1ZSIsInN1YnN0cmluZyIsImxlbmd0aCIsIm0iLCJtYXRjaCIsInJlcGxhY2UiLCJzdGRvdXQiLCJ0b1N0cmluZyJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUFBOztBQUNBOztBQUVBLElBQUlBLFlBQUo7QUFFQTs7Ozs7O0FBS08sZUFBZUMsTUFBZixHQUF3QjtBQUM5QixNQUFJRCxZQUFZLEtBQUtFLFNBQXJCLEVBQWdDO0FBQy9CLFdBQU9GLFlBQVA7QUFDQTs7QUFFRCxNQUFJRyxPQUFPLENBQUNDLFFBQVIsS0FBcUIsT0FBekIsRUFBa0M7QUFDakMsUUFBSUMsS0FBSyxHQUFHLE1BQU0sc0JBQUksTUFBSixFQUFZLDhCQUFaLEVBQTRDLFFBQTVDLENBQWxCOztBQUNBLFFBQUlBLEtBQUosRUFBVztBQUNWQSxNQUFBQSxLQUFLLEdBQUdBLEtBQUssQ0FBQ0MsU0FBTixDQUFnQkQsS0FBSyxDQUFDRSxNQUFOLEdBQWUsQ0FBL0IsRUFBa0NGLEtBQUssQ0FBQ0UsTUFBeEMsQ0FBUjtBQUNBLFlBQU1OLE1BQU0sR0FBRyxNQUFNLHNCQUFJLE1BQUosRUFBWSw0Q0FBWixFQUEwREksS0FBMUQsQ0FBckI7QUFDQSxZQUFNRyxDQUFDLEdBQUdQLE1BQU0sQ0FBQ1EsS0FBUCxDQUFhLGNBQWIsQ0FBVjtBQUNBVCxNQUFBQSxZQUFZLEdBQUdRLENBQUMsR0FBR0EsQ0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KCdIS0xNJywgJ1NPRlRXQVJFXFxcXENsYXNzZXNcXFxcTUlNRVxcXFxEYXRhYmFzZVxcXFxSZmMxNzY2JywgdmFsdWUpO1xuXHRcdFx0XHRjb25zdCBtID0gbG9jYWxlLm1hdGNoKC8oW147LFxcbl0rPyk7Lyk7XG5cdFx0XHRcdGNhY2hlZExvY2FsZSA9IG0gPyBtWzFdLnJlcGxhY2UoL18vZywgJy0nKSA6IG51bGw7XG5cdFx0XHR9XG5cdFx0fSBlbHNlIHtcblx0XHRcdGNvbnN0IG0gPSBzcGF3blN5bmMoJ2xvY2FsZScpLnN0ZG91dC50b1N0cmluZygpLm1hdGNoKC9eTEFORz1cIj8oW15cIi5cXHNdKykvKTtcblx0XHRcdGNhY2hlZExvY2FsZSA9IG0gPyBtWzFdLnJlcGxhY2UoL18vZywgJy0nKSA6IG51bGw7XG5cdFx0fVxuXHR9IGNhdGNoIChlKSB7XG5cdFx0Ly8gdGhpcyBjYW4gaGFwcGVuIGlmIHRoZSAnbG9jYWxlJyBjb21tYW5kIGlzIG5vdCBmb3VuZCBpbiB0aGUgc3lzdGVtIHBhdGhcblx0XHRjYWNoZWRMb2NhbGUgPSBudWxsO1xuXHR9XG5cblx0cmV0dXJuIGNhY2hlZExvY2FsZTtcbn1cbiJdLCJmaWxlIjoibG9jYWxlLmpzIn0= |
{ | ||
"name": "appcd-response", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "Library for responses and errors with i18n support and error codes.", | ||
@@ -19,10 +19,10 @@ "main": "./dist/index", | ||
"dependencies": { | ||
"appcd-fs": "^1.1.5", | ||
"appcd-path": "^1.1.4", | ||
"appcd-winreg": "^1.1.4", | ||
"source-map-support": "^0.5.10", | ||
"appcd-fs": "^1.1.6", | ||
"appcd-path": "^1.1.5", | ||
"appcd-winreg": "^1.1.5", | ||
"source-map-support": "^0.5.11", | ||
"sprintf-js": "^1.1.2" | ||
}, | ||
"devDependencies": { | ||
"appcd-gulp": "^2.0.0" | ||
"appcd-gulp": "^2.1.0" | ||
}, | ||
@@ -29,0 +29,0 @@ "homepage": "https://github.com/appcelerator/appc-daemon/tree/master/packages/appcd-response", |
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
72380
821
Updatedappcd-fs@^1.1.6
Updatedappcd-path@^1.1.5
Updatedappcd-winreg@^1.1.5
Updatedsource-map-support@^0.5.11