use i18next interpolation instead of concatenating strings

This commit is contained in:
Marcus Jaschen 2024-10-20 17:37:34 +02:00 committed by Gautier P
parent 8c21a88b15
commit 59a14356f7
2 changed files with 13 additions and 6 deletions

View file

@ -180,13 +180,19 @@ BR.TrackAnalysis = L.Class.extend({
case 'surface': case 'surface':
case 'smoothness': case 'smoothness':
if (typeof analysis[tagName][wayTagParts[1]] === 'undefined') { if (typeof analysis[tagName][wayTagParts[1]] === 'undefined') {
let formattedName = i18next.t([ let formattedName;
'sidebar.analysis.data.' + tagName + '.' + wayTagParts[1],
wayTagParts[1],
]);
if (tagName.indexOf('maxspeed') === 0) { if (tagName.indexOf('maxspeed') === 0) {
formattedName += ' km/h'; formattedName = i18next.t('sidebar.analysis.data.maxspeed', {
maxspeed: wayTagParts[1],
});
} else {
formattedName = i18next.t([
'sidebar.analysis.data.' + tagName + '.' + wayTagParts[1],
wayTagParts[1],
]);
} }
analysis[tagName][wayTagParts[1]] = { analysis[tagName][wayTagParts[1]] = {
formatted_name: formattedName, formatted_name: formattedName,
name: wayTagParts[1], name: wayTagParts[1],

View file

@ -338,7 +338,8 @@
"horrible": "Horrible", "horrible": "Horrible",
"very_horrible": "Very Horrible", "very_horrible": "Very Horrible",
"impassable": "Impassable" "impassable": "Impassable"
} },
"maxspeed": "{{maxspeed}} km/h"
}, },
"header": { "header": {
"highway": "Highway", "highway": "Highway",