luci-app-openvpn: fix advanced mode page switcher translation
Translation of page titles in the advanced configuration mode is done in such a way that the strings to be translated are not visible for 'i18n-scan.pl' script. This commit fixes this and makes page titles visible for the 'i18n-scan.pl'. Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
This commit is contained in:
parent
3e36a45dbf
commit
cac2248bcf
2 changed files with 18 additions and 15 deletions
|
@ -6,12 +6,13 @@ local fs = require("nixio.fs")
|
||||||
local knownParams = {
|
local knownParams = {
|
||||||
--
|
--
|
||||||
--Widget
|
--Widget
|
||||||
-- Name
|
-- ID
|
||||||
|
-- Display name
|
||||||
-- Default(s)
|
-- Default(s)
|
||||||
-- Description
|
-- Description
|
||||||
-- Option(s)
|
-- Option(s)
|
||||||
|
|
||||||
{ "Service", {
|
{ "service", translate("Service"), {
|
||||||
-- initialisation and daemon options
|
-- initialisation and daemon options
|
||||||
{ ListValue,
|
{ ListValue,
|
||||||
"verb",
|
"verb",
|
||||||
|
@ -164,7 +165,7 @@ local knownParams = {
|
||||||
translate("Enable a compression algorithm") },
|
translate("Enable a compression algorithm") },
|
||||||
} },
|
} },
|
||||||
|
|
||||||
{ "Networking", {
|
{ "networking", translate("Networking"), {
|
||||||
-- socket config
|
-- socket config
|
||||||
{ ListValue,
|
{ ListValue,
|
||||||
"mode",
|
"mode",
|
||||||
|
@ -364,7 +365,7 @@ local knownParams = {
|
||||||
{dev_type="tun" } },
|
{dev_type="tun" } },
|
||||||
} },
|
} },
|
||||||
|
|
||||||
{ "VPN", {
|
{ "vpn", translate("VPN"), {
|
||||||
{ Value,
|
{ Value,
|
||||||
"server",
|
"server",
|
||||||
"10.200.200.0 255.255.255.0",
|
"10.200.200.0 255.255.255.0",
|
||||||
|
@ -560,7 +561,7 @@ local knownParams = {
|
||||||
translate("Specify whether the client is required to supply a valid certificate") },
|
translate("Specify whether the client is required to supply a valid certificate") },
|
||||||
} },
|
} },
|
||||||
|
|
||||||
{ "Cryptography", {
|
{ "cryptography", translate("Cryptography"), {
|
||||||
{ FileUpload,
|
{ FileUpload,
|
||||||
"secret",
|
"secret",
|
||||||
"/etc/openvpn/secret.key",
|
"/etc/openvpn/secret.key",
|
||||||
|
@ -797,6 +798,7 @@ local knownParams = {
|
||||||
|
|
||||||
local cts = { }
|
local cts = { }
|
||||||
local params = { }
|
local params = { }
|
||||||
|
local title = ""
|
||||||
|
|
||||||
local m = Map("openvpn")
|
local m = Map("openvpn")
|
||||||
m.redirect = luci.dispatcher.build_url("admin", "vpn", "openvpn")
|
m.redirect = luci.dispatcher.build_url("admin", "vpn", "openvpn")
|
||||||
|
@ -806,22 +808,23 @@ local p = m:section( SimpleSection )
|
||||||
p.template = "openvpn/pageswitch"
|
p.template = "openvpn/pageswitch"
|
||||||
p.mode = "advanced"
|
p.mode = "advanced"
|
||||||
p.instance = arg[1]
|
p.instance = arg[1]
|
||||||
p.category = arg[2] or "Service"
|
p.category = arg[2] or knownParams[1][1]
|
||||||
|
|
||||||
for _, c in ipairs(knownParams) do
|
for _, c in ipairs(knownParams) do
|
||||||
cts[#cts+1] = c[1]
|
cts[#cts+1] = { id = c[1], title = c[2] }
|
||||||
if c[1] == p.category then params = c[2] end
|
if c[1] == p.category then
|
||||||
|
title = c[2]
|
||||||
|
params = c[3]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
p.categories = cts
|
p.categories = cts
|
||||||
|
|
||||||
|
|
||||||
local s = m:section(
|
local s = m:section(
|
||||||
NamedSection, arg[1], "openvpn",
|
NamedSection, arg[1], "openvpn", title
|
||||||
translate("%s" % arg[2])
|
|
||||||
)
|
)
|
||||||
|
|
||||||
s.title = translate("%s" % arg[2])
|
|
||||||
s.addremove = false
|
s.addremove = false
|
||||||
s.anonymous = true
|
s.anonymous = true
|
||||||
|
|
||||||
|
|
|
@ -12,17 +12,17 @@
|
||||||
<%=luci.i18n.translatef("Instance \"%s\"", self.instance)%>
|
<%=luci.i18n.translatef("Instance \"%s\"", self.instance)%>
|
||||||
</h3>
|
</h3>
|
||||||
<% if self.mode == "basic" then %>
|
<% if self.mode == "basic" then %>
|
||||||
<a href="<%=url('admin/vpn/openvpn/advanced', self.instance, "Service")%>"><%:Switch to advanced configuration%> »</a><p/>
|
<a href="<%=url('admin/vpn/openvpn/advanced', self.instance)%>"><%:Switch to advanced configuration%> »</a><p/>
|
||||||
<hr />
|
<hr />
|
||||||
<% elseif self.mode == "advanced" then %>
|
<% elseif self.mode == "advanced" then %>
|
||||||
<a href="<%=url('admin/vpn/openvpn/basic', self.instance)%>"><%:Switch to basic configuration%> »</a><p/>
|
<a href="<%=url('admin/vpn/openvpn/basic', self.instance)%>"><%:Switch to basic configuration%> »</a><p/>
|
||||||
<hr />
|
<hr />
|
||||||
<%:Configuration category%>:
|
<%:Configuration category%>:
|
||||||
<% for i, c in ipairs(self.categories) do %>
|
<% for i, c in ipairs(self.categories) do %>
|
||||||
<% if c == self.category then %>
|
<% if c.id == self.category then %>
|
||||||
<strong><%=translate(c)%></strong>
|
<strong><%=c.title%></strong>
|
||||||
<% else %>
|
<% else %>
|
||||||
<a href="<%=luci.dispatcher.build_url("admin", "vpn", "openvpn", "advanced", self.instance, c)%>"><%=translate(c)%></a>
|
<a href="<%=luci.dispatcher.build_url("admin", "vpn", "openvpn", "advanced", self.instance, c.id)%>"><%=c.title%></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if next(self.categories, i) then %>|<% end %>
|
<% if next(self.categories, i) then %>|<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in a new issue