diff --git a/modules/renderer/background_source.js b/modules/renderer/background_source.js index 771fd7bec..9d4440961 100644 --- a/modules/renderer/background_source.js +++ b/modules/renderer/background_source.js @@ -61,13 +61,13 @@ export function rendererBackgroundSource(data) { source.name = function() { - var id_safe = source.id.replace('.', ''); + var id_safe = source.id.replace(/\./g, ''); return t('imagery.' + id_safe + '.name', { default: name }); }; source.description = function() { - var id_safe = source.id.replace('.', ''); + var id_safe = source.id.replace(/\./g, ''); return t('imagery.' + id_safe + '.description', { default: description }); }; diff --git a/modules/ui/attribution.js b/modules/ui/attribution.js index 23d473b65..d2b0dcaec 100644 --- a/modules/ui/attribution.js +++ b/modules/ui/attribution.js @@ -44,7 +44,7 @@ export function uiAttribution(context) { } - var id_safe = d.id.replace('.', ''); + var id_safe = d.id.replace(/\./g, ''); var terms_text = t('imagery.' + id_safe + '.attribution.text', { default: d.terms_text || d.id || d.name() } ); diff --git a/modules/util/locale.js b/modules/util/locale.js index 1ed2c2b7e..2257e16f0 100644 --- a/modules/util/locale.js +++ b/modules/util/locale.js @@ -3,11 +3,11 @@ var translations = Object.create(null); export var currentLocale = 'en'; export var textDirection = 'ltr'; -export function setLocale(_) { - if (translations[_] !== undefined) { - currentLocale = _; - } else if (translations[_.split('-')[0]]) { - currentLocale = _.split('-')[0]; +export function setLocale(val) { + if (translations[val] !== undefined) { + currentLocale = val; + } else if (translations[val.split('-')[0]]) { + currentLocale = val.split('-')[0]; } } @@ -30,7 +30,7 @@ export function t(s, o, loc) { var path = s .split('.') - .map(function (s) { return s.replace('', '.'); }) + .map(function (s) { return s.replace(//g, '.'); }) .reverse(); var rep = translations[loc];