From 39b7dd4a0ada7ec25898268e4ff61d079947da91 Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Mon, 2 Sep 2019 13:37:08 +0200 Subject: [PATCH] Handle i18n of profile parameters --- js/control/Profile.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/js/control/Profile.js b/js/control/Profile.js index 338fb56..1f044a4 100644 --- a/js/control/Profile.js +++ b/js/control/Profile.js @@ -159,10 +159,19 @@ BR.Profile = L.Evented.extend({ return; } label.appendChild(input); - label.append(' ' + param); + var name = i18next.exists('profileParameters.' + param + '.name') + ? i18next.t('profileParameters.' + param + '.name') + : param; + label.append(' ' + name); + div.appendChild(label); + var small = document.createElement('small'); - small.innerHTML = ' (' + params[param].description.replace(/^\s+|\s+$/g, '') + ')'; + var description = i18next.exists('profileParameters.' + param + '.description') + ? i18next.t('profileParameters.' + param + '.description') + : params[param].description.replace(/^\s+|\s+$/g, ''); + small.innerHTML = ' (' + description + ')'; + div.appendChild(small); paramsSection.appendChild(div); });