luci-app-vpnbypass: better localizeable resources

Signed-off-by: Stan Grishin <stangri@melmac.net>
This commit is contained in:
Stan Grishin 2020-05-02 22:18:03 +00:00
parent bbf8e1e76d
commit 292c6d7bb0
4 changed files with 43 additions and 47 deletions

View file

@ -10,7 +10,7 @@ LUCI_TITLE:=VPN Bypass Web UI
LUCI_DESCRIPTION:=Provides Web UI for VPNBypass service. LUCI_DESCRIPTION:=Provides Web UI for VPNBypass service.
LUCI_DEPENDS:=+luci-compat +luci-mod-admin-full +vpnbypass LUCI_DEPENDS:=+luci-compat +luci-mod-admin-full +vpnbypass
LUCI_PKGARCH:=all LUCI_PKGARCH:=all
PKG_RELEASE:=16 PKG_RELEASE:=19
include ../../luci.mk include ../../luci.mk

View file

@ -1,7 +1,10 @@
module("luci.controller.vpnbypass", package.seeall) module("luci.controller.vpnbypass", package.seeall)
function index() function index()
if nixio.fs.access("/etc/config/vpnbypass") then 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"}, cbi("vpnbypass"), _("VPN Bypass"))
entry({"admin", "vpn", "vpnbypass", "action"}, call("vpnbypass_action"), nil).leaf = true entry({"admin", "vpn", "vpnbypass", "action"}, call("vpnbypass_action"), nil).leaf = true
end end

View file

@ -5,12 +5,9 @@ local util = require "luci.util"
local packageName = "vpnbypass" local packageName = "vpnbypass"
local packageVersion, statusText = nil, nil local packageVersion, statusText = nil, nil
packageVersion = tostring(util.trim(sys.exec("opkg list-installed " .. packageName .. " | awk '{print $3}'"))) packageVersion = tostring(util.trim(sys.exec("opkg list-installed " .. packageName .. " | awk '{print $3}'"))) or ""
if not packageVersion or packageVersion == "" then if packageVersion == "" then
packageVersion = "" statusText = translatef("%s is not installed or not found", packageName)
statusText = packageName .. " " .. translate("is not installed or not found")
else
packageVersion = " [" .. packageName .. " " .. packageVersion .. "]"
end end
local serviceRunning, serviceEnabled = false, false local serviceRunning, serviceEnabled = false, false
@ -26,13 +23,13 @@ if serviceRunning then
else else
statusText = translate("Stopped") statusText = translate("Stopped")
if not serviceEnabled then if not serviceEnabled then
statusText = statusText .. " (" .. translate("disabled") .. ")" statusText = translatef("%s (disabled)", statusText)
end end
end end
m = Map("vpnbypass", translate("VPN Bypass Settings")) 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 = h:option(DummyValue, "_dummy", translate("Service Status"))
ss.template = packageName .. "/status" ss.template = packageName .. "/status"
ss.value = statusText ss.value = statusText
@ -75,9 +72,8 @@ d = Map("dhcp")
s4 = d:section(TypedSection, "dnsmasq") s4 = d:section(TypedSection, "dnsmasq")
s4.anonymous = true s4.anonymous = true
di = s4:option(DynamicList, "ipset", translate("Domains to Bypass"), di = s4:option(DynamicList, "ipset", translate("Domains to Bypass"),
translate("Domains to be accessed directly (outside of the VPN tunnel), see ") translatef("Domains to be accessed directly (outside of the VPN tunnel), see %sREADME%s for syntax",
.. [[<a href="]] .. readmeURL .. [[#bypass-domains-formatsyntax" target="_blank">]] "<a href=\"" .. readmeURL .. "#bypass-domains-formatsyntax" .. "\" target=\"_blank\">", "</a>"))
.. translate("README") .. [[</a> ]] .. translate("for syntax"))
function d.on_after_commit(map) function d.on_after_commit(map)
util.exec("/etc/init.d/dnsmasq restart >/dev/null 2>&1") util.exec("/etc/init.d/dnsmasq restart >/dev/null 2>&1")
end end

View file

@ -1,16 +1,26 @@
msgid "" msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8" 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 #: applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm:57
msgid "Disable" msgid "Disable"
msgstr "" 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" msgid "Domains to Bypass"
msgstr "" msgstr ""
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:78 #: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:75
msgid "Domains to be accessed directly (outside of the VPN tunnel), see" msgid ""
"Domains to be accessed directly (outside of the VPN tunnel), see %sREADME%s "
"for syntax"
msgstr "" msgstr ""
#: applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm:54 #: applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm:54
@ -21,43 +31,39 @@ msgstr ""
msgid "Loading" msgid "Loading"
msgstr "" 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" msgid "Local IP Addresses to Bypass"
msgstr "" msgstr ""
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:60 #: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:57
msgid "" msgid ""
"Local IP addresses or subnets with direct internet access (outside of the " "Local IP addresses or subnets with direct internet access (outside of the "
"VPN tunnel)" "VPN tunnel)"
msgstr "" 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" msgid "Local Ports to Bypass"
msgstr "" 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" msgid "Local ports to trigger VPN Bypass"
msgstr "" msgstr ""
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:80 #: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:64
msgid "README"
msgstr ""
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:67
msgid "Remote IP Addresses to Bypass" msgid "Remote IP Addresses to Bypass"
msgstr "" msgstr ""
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:67 #: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:64
msgid "" msgid ""
"Remote IP addresses or subnets which will be accessed directly (outside of " "Remote IP addresses or subnets which will be accessed directly (outside of "
"the VPN tunnel)" "the VPN tunnel)"
msgstr "" 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" msgid "Remote Ports to Bypass"
msgstr "" 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" msgid "Remote ports to trigger VPN Bypass"
msgstr "" msgstr ""
@ -65,15 +71,18 @@ msgstr ""
msgid "Restart" msgid "Restart"
msgstr "" msgstr ""
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:25 #: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:22
msgid "Running" msgid "Running"
msgstr "" msgstr ""
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:35 #: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:33
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:36
msgid "Service Status" msgid "Service Status"
msgstr "" 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 #: applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm:41
msgid "Start" msgid "Start"
msgstr "" msgstr ""
@ -82,7 +91,7 @@ msgstr ""
msgid "Stop" msgid "Stop"
msgstr "" msgstr ""
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:27 #: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:24
msgid "Stopped" msgid "Stopped"
msgstr "" msgstr ""
@ -90,26 +99,14 @@ msgstr ""
msgid "VPN" msgid "VPN"
msgstr "" msgstr ""
#: applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua:5 #: applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua:8
msgid "VPN Bypass" msgid "VPN Bypass"
msgstr "" 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" msgid "VPN Bypass Rules"
msgstr "" 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" msgid "VPN Bypass Settings"
msgstr "" 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 ""