From: Stan Grishin Date: Sat, 2 May 2020 22:17:49 +0000 (+0000) Subject: luci-app-vpnbypass: better localizeable resources X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=refs%2Fpull%2F4002%2Fhead;p=oweals%2Fluci.git luci-app-vpnbypass: better localizeable resources Signed-off-by: Stan Grishin --- diff --git a/applications/luci-app-vpnbypass/Makefile b/applications/luci-app-vpnbypass/Makefile index cfcafec05..279524493 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/controller/vpnbypass.lua b/applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua index 77753020d..d5f4a8caf 100644 --- a/applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua +++ b/applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua @@ -1,7 +1,10 @@ module("luci.controller.vpnbypass", package.seeall) function index() if nixio.fs.access("/etc/config/vpnbypass") then - entry({"admin", "vpn"}, firstchild(), _("VPN"), 60).dependent=false + local e = entry({"admin", "vpn"}, firstchild(), _("VPN"), 60) + e.dependent = false + e.acl_depends = { "luci-app-vpnbypass" } + entry({"admin", "vpn", "vpnbypass"}, cbi("vpnbypass"), _("VPN Bypass")) entry({"admin", "vpn", "vpnbypass", "action"}, call("vpnbypass_action"), nil).leaf = true end diff --git a/applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua b/applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua index 0afdd7b0e..8a70bd1bb 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 8778dc228..56f03560f 100644 --- a/applications/luci-app-vpnbypass/po/templates/vpnbypass.pot +++ b/applications/luci-app-vpnbypass/po/templates/vpnbypass.pot @@ -1,16 +1,26 @@ 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 @@ -21,43 +31,39 @@ msgstr "" 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 "" @@ -65,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 "" @@ -82,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 "" @@ -90,26 +99,14 @@ msgstr "" msgid "VPN" msgstr "" -#: applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua:5 +#: applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua:8 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 ""