diff --git a/package.json b/package.json index 0247d98..1a3cd9c 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ }, "author": "info@doyensec.com", "license": "Apache-2.0", - "i18nSource": "https://electronegativity-i18n.s3.us-west-2.amazonaws.com/", + "i18nSource": "https://electronegativity-i18n.s3.us-west-2.amazonaws.com", "bugs": { "url": "https://github.com/doyensec/electronegativity/issues" }, diff --git a/src/locales/en-US.json b/src/locales/en-US.json index 8723e4b..db11650 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -122,5 +122,5 @@ "LIMIT_NAVIGATION_GLOBAL_CHECK_NONE_FOUND":"Missing navigation limits using .on new-window and will-navigate events", "LIMIT_NAVIGATION_GLOBAL_CHECK_NEW_WINDOW_MISSING":"Missing .on new-window navigation limit", "LIMIT_NAVIGATION_GLOBAL_CHECK_WILL_NAVIGATE_MISSING":"Missing .on will-navigate navigation limit", - "PERMISSION_REQUEST_HANDLER_GLOBAL_CHECK":"Missing PermissionRequestHandler to limit specific permissions (e.g. openExternal) in response to events from particular origins.", + "PERMISSION_REQUEST_HANDLER_GLOBAL_CHECK":"Missing PermissionRequestHandler to limit specific permissions (e.g. openExternal) in response to events from particular origins." } \ No newline at end of file diff --git a/src/locales/i18n.js b/src/locales/i18n.js index e11fdeb..c7935bf 100644 --- a/src/locales/i18n.js +++ b/src/locales/i18n.js @@ -5,7 +5,7 @@ export default function _i18n () { return new Promise((resolve, reject) => { var defaultLocale = "en-US"; i18n.configure({ - locales: ['en-US'], // widespread locales available locally + locales: ['en-US', 'es-ES', 'fr-FR'], // some widespread locales available locally defaultLocale: defaultLocale, directory: __dirname, updateFiles: false, @@ -16,17 +16,18 @@ export default function _i18n () { defaultLocale = process.env.LANG ? process.env.LANG : defaultLocale; const i18nSource = require('../../package.json').i18nSource; - return got(`${i18nSource}/${defaultLocale}.json`) + got(`${i18nSource}/${defaultLocale}.json`, {timeout: {request: 1000}}) .then(r => { if (r.statusCode === 200) {// Add JSON translations to i18n i18n.addLocale(defaultLocale, JSON.parse(r.body)); i18n.setLocale(defaultLocale); - resolve(); // resolve the promise when the setLocale is set } + resolve(); // resolve the promise }) .catch(e => { - // Could not retrieve updated translations for the current locale - reject(e); + console.log("Could not retrieve updated translations for the current locale"); + i18n.setLocale(defaultLocale); + resolve(); }); }); }; \ No newline at end of file