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 'smoothness':
if (typeof analysis[tagName][wayTagParts[1]] === 'undefined') {
let formattedName = i18next.t([
let formattedName;
if (tagName.indexOf('maxspeed') === 0) {
formattedName = i18next.t('sidebar.analysis.data.maxspeed', {
maxspeed: wayTagParts[1],
});
} else {
formattedName = i18next.t([
'sidebar.analysis.data.' + tagName + '.' + wayTagParts[1],
wayTagParts[1],
]);
if (tagName.indexOf('maxspeed') === 0) {
formattedName += ' km/h';
}
analysis[tagName][wayTagParts[1]] = {
formatted_name: formattedName,
name: wayTagParts[1],

View file

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