loleaflet: Don't try to translate command names

Command names are sent to loleaflet in already translated form when
there are appropriate langpacks installed in the system.

Only translate when we can.

Change-Id: I92dc5865da85c76bd5a2529b0e6df994937c4c28
This commit is contained in:
Pranav Kant 2018-02-02 21:37:58 +05:30
parent d837839449
commit 34aed93d83

View file

@ -1399,7 +1399,12 @@ function updateCommandValues() {
data = data.concat({text: '\u2500\u2500\u2500\u2500\u2500\u2500', disabled: true});
commands.forEach(function (command) {
data = data.concat({id: command.id, text: L.Styles.styleMappings[command.text].toLocaleString()});
var translated = command.text;
if (L.Styles.styleMappings[command.text]) {
// if it's in English, translate it
translated = L.Styles.styleMappings[command.text].toLocaleString();
}
data = data.concat({id: command.id, text: translated });
}, this);
}