From 94e7827ac8e603c494c17669c90f9ce6b3c61c53 Mon Sep 17 00:00:00 2001 From: Christof Schulze Date: Tue, 31 Oct 2017 19:25:27 +0100 Subject: [PATCH] gluon-status-page: improve localization (#1241) --- .../src/js/lib/gui/nodeinfo.js | 17 ++++++++++++++--- package/gluon-status-page/src/js/lib/helper.js | 5 ++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/package/gluon-status-page/src/js/lib/gui/nodeinfo.js b/package/gluon-status-page/src/js/lib/gui/nodeinfo.js index 1441b34e..4fc08123 100644 --- a/package/gluon-status-page/src/js/lib/gui/nodeinfo.js +++ b/package/gluon-status-page/src/js/lib/gui/nodeinfo.js @@ -5,12 +5,16 @@ define(["lib/helper"], function (Helper) { update(nodeInfo) - function dlEntry(dl, dict, key, prettyName) { + function dlEntry(dl, dict, key, prettyName, transform) { var v = Helper.dictGet(dict, key.split(".")) if (v === null) return + if (transform) { + v = transform(v) + } + var dt = document.createElement("dt") var dd = document.createElement("dd") @@ -30,6 +34,13 @@ define(["lib/helper"], function (Helper) { dl.appendChild(dd) } + function enabledDisabled(v) { + if (v) { + return Helper._("enabled"); + } + return Helper._("disabled"); + } + function update(nodeInfo) { var list = document.createElement("dl") @@ -39,8 +50,8 @@ define(["lib/helper"], function (Helper) { dlEntry(list, nodeInfo, "network.mac", Helper._("Primary MAC")) dlEntry(list, nodeInfo, "network.addresses", Helper._("IP Address")) dlEntry(list, nodeInfo, "software.firmware.release", Helper._("Firmware")) - dlEntry(list, nodeInfo, "software.fastd.enabled", "Mesh-VPN") - dlEntry(list, nodeInfo, "software.autoupdater.enabled", Helper._("Automatic updates")) + dlEntry(list, nodeInfo, "software.fastd.enabled", Helper._("Mesh VPN"), enabledDisabled) + dlEntry(list, nodeInfo, "software.autoupdater.enabled", Helper._("Automatic updates"), enabledDisabled) dlEntry(list, nodeInfo, "software.autoupdater.branch", Helper._("Branch")) el.appendChild(list) diff --git a/package/gluon-status-page/src/js/lib/helper.js b/package/gluon-status-page/src/js/lib/helper.js index 5640e76f..75bace13 100644 --- a/package/gluon-status-page/src/js/lib/helper.js +++ b/package/gluon-status-page/src/js/lib/helper.js @@ -106,7 +106,10 @@ define([ "bacon" ], function (Bacon) { "not connected": "nicht verbunden", "Packets/s": "Pakete/s", "Statistic": "Statistik", - "Neighbors": "Nachbarknoten" + "Neighbors": "Nachbarknoten", + "Mesh VPN": "Mesh-VPN", + "enabled": "aktiviert", + "disabled": "deaktiviert" }, "ru": { "Node": "Узел",