Skip to content

Commit

Permalink
Escape all .s in imagery identifiers, not just the first one
Browse files Browse the repository at this point in the history
(closes #5737)
  • Loading branch information
bhousel committed Jan 19, 2019
1 parent 19a8f5c commit 2df39c1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions modules/renderer/background_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
};

Expand Down
2 changes: 1 addition & 1 deletion modules/ui/attribution.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
);
Expand Down
12 changes: 6 additions & 6 deletions modules/util/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}

Expand All @@ -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];
Expand Down

0 comments on commit 2df39c1

Please sign in to comment.