From d5422a7cbc424d5da24bce852fbde0e141b53330 Mon Sep 17 00:00:00 2001 From: Stan Grishin Date: Sat, 2 May 2020 22:17:35 +0000 Subject: [PATCH] luci-app-vpnbypass: better localizeable resources Signed-off-by: Stan Grishin --- applications/luci-app-vpnbypass/Makefile | 2 +- .../luasrc/model/cbi/vpnbypass.lua | 18 ++--- .../po/templates/vpnbypass.pot | 67 +++++++++---------- 3 files changed, 38 insertions(+), 49 deletions(-) diff --git a/applications/luci-app-vpnbypass/Makefile b/applications/luci-app-vpnbypass/Makefile index cfcafec05b..2795244935 100644 --- a/applications/luci-app-vpnbypass/Makefile +++ b/applications/luci-app-vpnbypass/Makefile @@ -10,7 +10,7 @@ LUCI_TITLE:=VPN Bypass Web UI LUCI_DESCRIPTION:=Provides Web UI for VPNBypass service. LUCI_DEPENDS:=+luci-compat +luci-mod-admin-full +vpnbypass LUCI_PKGARCH:=all -PKG_RELEASE:=16 +PKG_RELEASE:=19 include ../../luci.mk diff --git a/applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua b/applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua index 0afdd7b0e1..8a70bd1bb9 100644 --- a/applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua +++ b/applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua @@ -5,12 +5,9 @@ local util = require "luci.util" local packageName = "vpnbypass" local packageVersion, statusText = nil, nil -packageVersion = tostring(util.trim(sys.exec("opkg list-installed " .. packageName .. " | awk '{print $3}'"))) -if not packageVersion or packageVersion == "" then - packageVersion = "" - statusText = packageName .. " " .. translate("is not installed or not found") -else - packageVersion = " [" .. packageName .. " " .. packageVersion .. "]" +packageVersion = tostring(util.trim(sys.exec("opkg list-installed " .. packageName .. " | awk '{print $3}'"))) or "" +if packageVersion == "" then + statusText = translatef("%s is not installed or not found", packageName) end local serviceRunning, serviceEnabled = false, false @@ -26,13 +23,13 @@ if serviceRunning then else statusText = translate("Stopped") if not serviceEnabled then - statusText = statusText .. " (" .. translate("disabled") .. ")" + statusText = translatef("%s (disabled)", statusText) end end m = Map("vpnbypass", translate("VPN Bypass Settings")) -h = m:section(NamedSection, "config", packageName, translate("Service Status") .. packageVersion) +h = m:section(NamedSection, "config", packageName, translatef("Service Status [%s %s]", packageName, packageVersion)) ss = h:option(DummyValue, "_dummy", translate("Service Status")) ss.template = packageName .. "/status" ss.value = statusText @@ -75,9 +72,8 @@ d = Map("dhcp") s4 = d:section(TypedSection, "dnsmasq") s4.anonymous = true di = s4:option(DynamicList, "ipset", translate("Domains to Bypass"), - translate("Domains to be accessed directly (outside of the VPN tunnel), see ") - .. [[]] - .. translate("README") .. [[ ]] .. translate("for syntax")) + translatef("Domains to be accessed directly (outside of the VPN tunnel), see %sREADME%s for syntax", + "", "")) function d.on_after_commit(map) util.exec("/etc/init.d/dnsmasq restart >/dev/null 2>&1") end diff --git a/applications/luci-app-vpnbypass/po/templates/vpnbypass.pot b/applications/luci-app-vpnbypass/po/templates/vpnbypass.pot index 48bcebe993..56f03560ff 100644 --- a/applications/luci-app-vpnbypass/po/templates/vpnbypass.pot +++ b/applications/luci-app-vpnbypass/po/templates/vpnbypass.pot @@ -1,67 +1,69 @@ msgid "" msgstr "Content-Type: text/plain; charset=UTF-8" +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:26 +msgid "%s (disabled)" +msgstr "" + +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:10 +msgid "%s is not installed or not found" +msgstr "" + #: applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm:57 msgid "Disable" msgstr "" -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:77 +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:74 msgid "Domains to Bypass" msgstr "" -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:78 -msgid "Domains to be accessed directly (outside of the VPN tunnel), see" +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:75 +msgid "" +"Domains to be accessed directly (outside of the VPN tunnel), see %sREADME%s " +"for syntax" msgstr "" #: applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm:54 msgid "Enable" msgstr "" -#: applications/luci-app-vpnbypass/root/usr/share/rpcd/acl.d/luci-app-vpnbypass.json:3 -msgid "Grant UCI access for luci-app-vpnbypass" -msgstr "" - #: applications/luci-app-vpnbypass/luasrc/view/vpnbypass/js.htm:51 msgid "Loading" msgstr "" -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:60 +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:57 msgid "Local IP Addresses to Bypass" msgstr "" -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:60 +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:57 msgid "" "Local IP addresses or subnets with direct internet access (outside of the " "VPN tunnel)" msgstr "" -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:46 +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:43 msgid "Local Ports to Bypass" msgstr "" -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:46 +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:43 msgid "Local ports to trigger VPN Bypass" msgstr "" -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:80 -msgid "README" -msgstr "" - -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:67 +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:64 msgid "Remote IP Addresses to Bypass" msgstr "" -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:67 +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:64 msgid "" "Remote IP addresses or subnets which will be accessed directly (outside of " "the VPN tunnel)" msgstr "" -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:53 +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:50 msgid "Remote Ports to Bypass" msgstr "" -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:53 +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:50 msgid "Remote ports to trigger VPN Bypass" msgstr "" @@ -69,15 +71,18 @@ msgstr "" msgid "Restart" msgstr "" -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:25 +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:22 msgid "Running" msgstr "" -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:35 -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:36 +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:33 msgid "Service Status" msgstr "" +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:32 +msgid "Service Status [%s %s]" +msgstr "" + #: applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm:41 msgid "Start" msgstr "" @@ -86,7 +91,7 @@ msgstr "" msgid "Stop" msgstr "" -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:27 +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:24 msgid "Stopped" msgstr "" @@ -98,22 +103,10 @@ msgstr "" msgid "VPN Bypass" msgstr "" -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:44 +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:41 msgid "VPN Bypass Rules" msgstr "" -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:33 +#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:30 msgid "VPN Bypass Settings" msgstr "" - -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:29 -msgid "disabled" -msgstr "" - -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:80 -msgid "for syntax" -msgstr "" - -#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:11 -msgid "is not installed or not found" -msgstr "" -- 2.30.2