From 8d7ebf057222078193b1b753084c35eabe605405 Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Sun, 22 Jul 2018 22:28:26 +0200 Subject: [PATCH] luci-app-adblock: fix translations * fix runtime & button translations Signed-off-by: Dirk Brenken --- .../luasrc/controller/adblock.lua | 8 ++-- .../luasrc/view/adblock/runtime.htm | 46 +++++++++++-------- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/applications/luci-app-adblock/luasrc/controller/adblock.lua b/applications/luci-app-adblock/luasrc/controller/adblock.lua index 664822140f..fad8834870 100644 --- a/applications/luci-app-adblock/luasrc/controller/adblock.lua +++ b/applications/luci-app-adblock/luasrc/controller/adblock.lua @@ -30,12 +30,12 @@ function index() entry({"admin", "services", "adblock", "action"}, call("adb_action"), nil).leaf = true end -function adb_action(value) - if value == "Suspend" then +function adb_action(name) + if name == "do_suspend" then luci.sys.call("/etc/init.d/adblock suspend >/dev/null 2>&1") - elseif value == "Resume" then + elseif name == "do_resume" then luci.sys.call("/etc/init.d/adblock resume >/dev/null 2>&1") - elseif value == "Refresh" then + elseif name == "do_refresh" then luci.sys.call("/etc/init.d/adblock reload >/dev/null 2>&1") end luci.http.prepare_content("text/plain") diff --git a/applications/luci-app-adblock/luasrc/view/adblock/runtime.htm b/applications/luci-app-adblock/luasrc/view/adblock/runtime.htm index bdcd0a1821..7609ba5e66 100644 --- a/applications/luci-app-adblock/luasrc/view/adblock/runtime.htm +++ b/applications/luci-app-adblock/luasrc/view/adblock/runtime.htm @@ -27,8 +27,10 @@ local sys = require("luci.sys") view.innerHTML = input || "-"; if (input === "enabled") { - btn1.value = "Suspend"; - btn2.value = "Refresh"; + btn1.value = "<%:Suspend%>"; + btn1.name = "do_suspend"; + btn2.value = "<%:Refresh%>"; + btn2.name = "do_refresh"; btn1.disabled = false; running(btn1_running, 0); btn2.disabled = false; @@ -36,8 +38,10 @@ local sys = require("luci.sys") } else if (input === "paused") { - btn1.value = "Resume"; - btn2.value = "Refresh"; + btn1.value = "<%:Resume%>"; + btn1.name = "do_resume"; + btn2.value = "<%:Refresh%>"; + btn2.name = "do_refresh"; btn1.disabled = false; running(btn1_running, 0); btn2.disabled = false; @@ -45,8 +49,10 @@ local sys = require("luci.sys") } else { - btn1.value = "Suspend"; - btn2.value = "Refresh"; + btn1.value = "<%:Suspend%>"; + btn1.name = "do_suspend"; + btn2.value = "<%:Refresh%>"; + btn2.name = "do_refresh"; btn1.disabled = true; btn2.disabled = true; } @@ -77,7 +83,7 @@ local sys = require("luci.sys") btn1.disabled = true; btn2.disabled = true; - if (action.value === "Refresh") + if (action.name === "do_refresh") { running(btn2_running, 1); } @@ -86,7 +92,7 @@ local sys = require("luci.sys") running(btn1_running, 1); } - new XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock")%>/action/' + action.value, null, + new XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock")%>/action/' + action.name, null, function(x) { if (!x) @@ -116,8 +122,10 @@ local sys = require("luci.sys") { var btn1 = document.getElementById("btn1"); var btn2 = document.getElementById("btn2"); - btn1.value = "Suspend"; - btn2.value = "Refresh"; + btn1.value = "<%:Suspend%>"; + btn1.name = "do_suspend"; + btn2.value = "<%:Refresh%>"; + btn2.name = "do_refresh"; btn1.disabled = true; btn2.disabled = false; return; @@ -137,46 +145,46 @@ local sys = require("luci.sys") //]]> -

Runtime Information

+

<%:Runtime Information%>

- +
-
- +
-
- +
-
- +
-
- +
-
- +
-

- +
@@ -184,7 +192,7 @@ local sys = require("luci.sys")

- +
-- 2.30.2