Escape all .s in imagery identifiers, not just the first one

(closes #5737)
This commit is contained in:
Bryan Housel
2019-01-19 10:53:09 -05:00
parent 19a8f5c47c
commit 2df39c1dc7
3 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -61,13 +61,13 @@ export function rendererBackgroundSource(data) {
source.name = function() {
var id_safe = source.id.replace('.', '<TX_DOT>');
var id_safe = source.id.replace(/\./g, '<TX_DOT>');
return t('imagery.' + id_safe + '.name', { default: name });
};
source.description = function() {
var id_safe = source.id.replace('.', '<TX_DOT>');
var id_safe = source.id.replace(/\./g, '<TX_DOT>');
return t('imagery.' + id_safe + '.description', { default: description });
};
+1 -1
View File
@@ -44,7 +44,7 @@ export function uiAttribution(context) {
}
var id_safe = d.id.replace('.', '<TX_DOT>');
var id_safe = d.id.replace(/\./g, '<TX_DOT>');
var terms_text = t('imagery.' + id_safe + '.attribution.text',
{ default: d.terms_text || d.id || d.name() }
);
+6 -6
View File
@@ -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('<TX_DOT>', '.'); })
.map(function (s) { return s.replace(/<TX_DOT>/g, '.'); })
.reverse();
var rep = translations[loc];