Merge pull request #1104 from musashino205/mwan3-fix-trans

luci-app-mwan3: Fix luci tools cannot detect translate()
This commit is contained in:
Hannu Nyman 2017-04-10 14:28:12 +03:00 committed by GitHub
commit 4ae4125a08
7 changed files with 26 additions and 26 deletions

View file

@ -59,24 +59,24 @@ end
function interfaceWarnings() -- display status and warning messages at the top of the page function interfaceWarnings() -- display status and warning messages at the top of the page
local warnings = "" local warnings = ""
if interfaceNumber <= 250 then if interfaceNumber <= 250 then
warnings = "<strong>There are currently " .. interfaceNumber .. " of 250 supported interfaces configured</strong>" warnings = "<strong>" .. translatef("There are currently %d of 250 supported interfaces configured", interfaceNumber) .. "</strong>"
else else
warnings = "<font color=\"ff0000\"><strong>WARNING: " .. interfaceNumber .. " interfaces are configured exceeding the maximum of 250!</strong></font>" warnings = "<font color=\"ff0000\"><strong>" .. translatef("WARNING: %d interfaces are configured exceeding the maximum of 250!", interfaceNumber) .. "</strong></font>"
end end
if errorReliabilityList ~= " " then if errorReliabilityList ~= " " then
warnings = warnings .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces have a higher reliability requirement than there are tracking IP addresses!</strong></font>" warnings = warnings .. "<br /><br /><font color=\"ff0000\"><strong>" .. translate("WARNING: some interfaces have a higher reliability requirement than there are tracking IP addresses!") .. "</strong></font>"
end end
if errorRouteList ~= " " then if errorRouteList ~= " " then
warnings = warnings .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces have no default route in the main routing table!</strong></font>" warnings = warnings .. "<br /><br /><font color=\"ff0000\"><strong>" .. translate("WARNING: some interfaces have no default route in the main routing table!") .. "</strong></font>"
end end
if errorNetConfigList ~= " " then if errorNetConfigList ~= " " then
warnings = warnings .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces are configured incorrectly or not at all in /etc/config/network!</strong></font>" warnings = warnings .. "<br /><br /><font color=\"ff0000\"><strong>" .. translate("WARNING: some interfaces are configured incorrectly or not at all in /etc/config/network!") .. "</strong></font>"
end end
if errorNoMetricList ~= " " then if errorNoMetricList ~= " " then
warnings = warnings .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces have no metric configured in /etc/config/network!</strong></font>" warnings = warnings .. "<br /><br /><font color=\"ff0000\"><strong>" .. translate("WARNING: some interfaces have no metric configured in /etc/config/network!") .. "</strong></font>"
end end
if errorDuplicateMetricList ~= " " then if errorDuplicateMetricList ~= " " then
warnings = warnings .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces have duplicate metrics configured in /etc/config/network!</strong></font>" warnings = warnings .. "<br /><br /><font color=\"ff0000\"><strong>" .. translate("WARNING: some interfaces have duplicate metrics configured in /etc/config/network!") .. "</strong></font>"
end end
return warnings return warnings
end end
@ -99,7 +99,7 @@ interfaceCheck()
m5 = Map("mwan3", translate("MWAN Interface Configuration"), m5 = Map("mwan3", translate("MWAN Interface Configuration"),
translate(interfaceWarnings())) interfaceWarnings())
m5:append(Template("mwan/config_css")) m5:append(Template("mwan/config_css"))

View file

@ -50,21 +50,21 @@ end
function interfaceWarnings() -- display warning messages at the top of the page function interfaceWarnings() -- display warning messages at the top of the page
local warns, lineBreak = "", "" local warns, lineBreak = "", ""
if errorReliability == 1 then if errorReliability == 1 then
warns = "<font color=\"ff0000\"><strong>WARNING: this interface has a higher reliability requirement than there are tracking IP addresses!</strong></font>" warns = "<font color=\"ff0000\"><strong>" .. translate("WARNING: this interface has a higher reliability requirement than there are tracking IP addresses!") .. "</strong></font>"
lineBreak = "<br /><br />" lineBreak = "<br /><br />"
end end
if errorRoute == 1 then if errorRoute == 1 then
warns = warns .. lineBreak .. "<font color=\"ff0000\"><strong>WARNING: this interface has no default route in the main routing table!</strong></font>" warns = warns .. lineBreak .. "<font color=\"ff0000\"><strong>" .. translate("WARNING: this interface has no default route in the main routing table!") .. "</strong></font>"
lineBreak = "<br /><br />" lineBreak = "<br /><br />"
end end
if errorNetConfig == 1 then if errorNetConfig == 1 then
warns = warns .. lineBreak .. "<font color=\"ff0000\"><strong>WARNING: this interface is configured incorrectly or not at all in /etc/config/network!</strong></font>" warns = warns .. lineBreak .. "<font color=\"ff0000\"><strong>" .. translate("WARNING: this interface is configured incorrectly or not at all in /etc/config/network!") .. "</strong></font>"
lineBreak = "<br /><br />" lineBreak = "<br /><br />"
end end
if errorNoMetric == 1 then if errorNoMetric == 1 then
warns = warns .. lineBreak .. "<font color=\"ff0000\"><strong>WARNING: this interface has no metric configured in /etc/config/network!</strong></font>" warns = warns .. lineBreak .. "<font color=\"ff0000\"><strong>" .. translate("WARNING: this interface has no metric configured in /etc/config/network!") .. "</strong></font>"
elseif errorDuplicateMetric == 1 then elseif errorDuplicateMetric == 1 then
warns = warns .. lineBreak .. "<font color=\"ff0000\"><strong>WARNING: this and other interfaces have duplicate metrics configured in /etc/config/network!</strong></font>" warns = warns .. lineBreak .. "<font color=\"ff0000\"><strong>" .. translate("WARNING: this and other interfaces have duplicate metrics configured in /etc/config/network!") .. "</strong></font>"
end end
return warns return warns
end end
@ -87,8 +87,8 @@ errorReliability = 0
interfaceCheck() interfaceCheck()
m5 = Map("mwan3", translate("MWAN Interface Configuration - " .. arg[1]), m5 = Map("mwan3", translatef("MWAN Interface Configuration - %s", arg[1]),
translate(interfaceWarnings())) interfaceWarnings())
m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "interface") m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "interface")

View file

@ -14,7 +14,7 @@ dsp = require "luci.dispatcher"
arg[1] = arg[1] or "" arg[1] = arg[1] or ""
m5 = Map("mwan3", translate("MWAN Member Configuration - ") .. arg[1]) m5 = Map("mwan3", translatef("MWAN Member Configuration - %s", arg[1]))
m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "member") m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "member")

View file

@ -13,7 +13,7 @@ end
function policyWarn() -- display status and warning messages at the top of the page function policyWarn() -- display status and warning messages at the top of the page
if nameTooLong == 1 then if nameTooLong == 1 then
return "<font color=\"ff0000\"><strong>WARNING: Some policies have names exceeding the maximum of 15 characters!</strong></font>" return "<font color=\"ff0000\"><strong>" .. translate("WARNING: Some policies have names exceeding the maximum of 15 characters!") .. "</strong></font>"
else else
return "" return ""
end end
@ -30,7 +30,7 @@ policyCheck()
m5 = Map("mwan3", translate("MWAN Policy Configuration"), m5 = Map("mwan3", translate("MWAN Policy Configuration"),
translate(policyWarn())) policyWarn())
m5:append(Template("mwan/config_css")) m5:append(Template("mwan/config_css"))

View file

@ -9,7 +9,7 @@ end
function policyWarn() -- display status and warning messages at the top of the page function policyWarn() -- display status and warning messages at the top of the page
if nameTooLong == 1 then if nameTooLong == 1 then
return "<font color=\"ff0000\"><strong>WARNING: this policy's name is " .. policyNameLength .. " characters exceeding the maximum of 15!</strong></font>" return "<font color=\"ff0000\"><strong>" .. translatef("WARNING: this policy's name is %d characters exceeding the maximum of 15!", policyNameLength) .. "</strong></font>"
else else
return "" return ""
end end
@ -32,8 +32,8 @@ nameTooLong = 0
policyCheck() policyCheck()
m5 = Map("mwan3", translate("MWAN Policy Configuration - " .. arg[1]), m5 = Map("mwan3", translatef("MWAN Policy Configuration - %s", arg[1]),
translate(policyWarn())) policyWarn())
m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "policy") m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "policy")

View file

@ -17,7 +17,7 @@ end
function ruleWarn() -- display warning messages at the top of the page function ruleWarn() -- display warning messages at the top of the page
if error_protocol_list ~= " " then if error_protocol_list ~= " " then
return "<font color=\"ff0000\"><strong>WARNING: some rules have a port configured with no or improper protocol specified! Please configure a specific protocol!</strong></font>" return "<font color=\"ff0000\"><strong>" .. translate("WARNING: some rules have a port configured with no or improper protocol specified! Please configure a specific protocol!") .. "</strong></font>"
else else
return "" return ""
end end
@ -34,7 +34,7 @@ ruleCheck()
m5 = Map("mwan3", translate("MWAN Rule Configuration"), m5 = Map("mwan3", translate("MWAN Rule Configuration"),
translate(ruleWarn())) ruleWarn())
m5:append(Template("mwan/config_css")) m5:append(Template("mwan/config_css"))

View file

@ -13,7 +13,7 @@ end
function ruleWarn() -- display warning message at the top of the page function ruleWarn() -- display warning message at the top of the page
if error_protocol == 1 then if error_protocol == 1 then
return "<font color=\"ff0000\"><strong>WARNING: this rule is incorrectly configured with no or improper protocol specified! Please configure a specific protocol!</strong></font>" return "<font color=\"ff0000\"><strong>" .. translate("WARNING: this rule is incorrectly configured with no or improper protocol specified! Please configure a specific protocol!") .. "</strong></font>"
else else
return "" return ""
end end
@ -45,8 +45,8 @@ error_protocol = 0
ruleCheck() ruleCheck()
m5 = Map("mwan3", translate("MWAN Rule Configuration - ") .. arg[1], m5 = Map("mwan3", translatef("MWAN Rule Configuration - %s", arg[1]),
translate(ruleWarn())) ruleWarn())
m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "rule") m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "rule")