From: Hannu Nyman Date: Mon, 10 Apr 2017 11:28:12 +0000 (+0300) Subject: Merge pull request #1104 from musashino205/mwan3-fix-trans X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=4ae4125a087882886cdd0bcba7ac6b14fd94bbde;hp=a162384bf70e1f5d9227f289aa5ab123a91a35a6 Merge pull request #1104 from musashino205/mwan3-fix-trans luci-app-mwan3: Fix luci tools cannot detect translate() --- diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua index a8e68a01b..7e863a371 100644 --- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua +++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua @@ -59,24 +59,24 @@ end function interfaceWarnings() -- display status and warning messages at the top of the page local warnings = "" if interfaceNumber <= 250 then - warnings = "There are currently " .. interfaceNumber .. " of 250 supported interfaces configured" + warnings = "" .. translatef("There are currently %d of 250 supported interfaces configured", interfaceNumber) .. "" else - warnings = "WARNING: " .. interfaceNumber .. " interfaces are configured exceeding the maximum of 250!" + warnings = "" .. translatef("WARNING: %d interfaces are configured exceeding the maximum of 250!", interfaceNumber) .. "" end if errorReliabilityList ~= " " then - warnings = warnings .. "

WARNING: some interfaces have a higher reliability requirement than there are tracking IP addresses!" + warnings = warnings .. "

" .. translate("WARNING: some interfaces have a higher reliability requirement than there are tracking IP addresses!") .. "" end if errorRouteList ~= " " then - warnings = warnings .. "

WARNING: some interfaces have no default route in the main routing table!" + warnings = warnings .. "

" .. translate("WARNING: some interfaces have no default route in the main routing table!") .. "" end if errorNetConfigList ~= " " then - warnings = warnings .. "

WARNING: some interfaces are configured incorrectly or not at all in /etc/config/network!" + warnings = warnings .. "

" .. translate("WARNING: some interfaces are configured incorrectly or not at all in /etc/config/network!") .. "" end if errorNoMetricList ~= " " then - warnings = warnings .. "

WARNING: some interfaces have no metric configured in /etc/config/network!" + warnings = warnings .. "

" .. translate("WARNING: some interfaces have no metric configured in /etc/config/network!") .. "" end if errorDuplicateMetricList ~= " " then - warnings = warnings .. "

WARNING: some interfaces have duplicate metrics configured in /etc/config/network!" + warnings = warnings .. "

" .. translate("WARNING: some interfaces have duplicate metrics configured in /etc/config/network!") .. "" end return warnings end @@ -99,7 +99,7 @@ interfaceCheck() m5 = Map("mwan3", translate("MWAN Interface Configuration"), - translate(interfaceWarnings())) + interfaceWarnings()) m5:append(Template("mwan/config_css")) diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua index e81ef74d2..e7c16fdfd 100644 --- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua +++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua @@ -50,21 +50,21 @@ end function interfaceWarnings() -- display warning messages at the top of the page local warns, lineBreak = "", "" if errorReliability == 1 then - warns = "WARNING: this interface has a higher reliability requirement than there are tracking IP addresses!" + warns = "" .. translate("WARNING: this interface has a higher reliability requirement than there are tracking IP addresses!") .. "" lineBreak = "

" end if errorRoute == 1 then - warns = warns .. lineBreak .. "WARNING: this interface has no default route in the main routing table!" + warns = warns .. lineBreak .. "" .. translate("WARNING: this interface has no default route in the main routing table!") .. "" lineBreak = "

" end if errorNetConfig == 1 then - warns = warns .. lineBreak .. "WARNING: this interface is configured incorrectly or not at all in /etc/config/network!" + warns = warns .. lineBreak .. "" .. translate("WARNING: this interface is configured incorrectly or not at all in /etc/config/network!") .. "" lineBreak = "

" end if errorNoMetric == 1 then - warns = warns .. lineBreak .. "WARNING: this interface has no metric configured in /etc/config/network!" + warns = warns .. lineBreak .. "" .. translate("WARNING: this interface has no metric configured in /etc/config/network!") .. "" elseif errorDuplicateMetric == 1 then - warns = warns .. lineBreak .. "WARNING: this and other interfaces have duplicate metrics configured in /etc/config/network!" + warns = warns .. lineBreak .. "" .. translate("WARNING: this and other interfaces have duplicate metrics configured in /etc/config/network!") .. "" end return warns end @@ -87,8 +87,8 @@ errorReliability = 0 interfaceCheck() -m5 = Map("mwan3", translate("MWAN Interface Configuration - " .. arg[1]), - translate(interfaceWarnings())) +m5 = Map("mwan3", translatef("MWAN Interface Configuration - %s", arg[1]), + interfaceWarnings()) m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "interface") diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/memberconfig.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/memberconfig.lua index 181d22e06..eb6f417af 100644 --- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/memberconfig.lua +++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/memberconfig.lua @@ -14,7 +14,7 @@ dsp = require "luci.dispatcher" 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") diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/policy.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/policy.lua index e141d696a..08c3f69de 100644 --- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/policy.lua +++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/policy.lua @@ -13,7 +13,7 @@ end function policyWarn() -- display status and warning messages at the top of the page if nameTooLong == 1 then - return "WARNING: Some policies have names exceeding the maximum of 15 characters!" + return "" .. translate("WARNING: Some policies have names exceeding the maximum of 15 characters!") .. "" else return "" end @@ -30,7 +30,7 @@ policyCheck() m5 = Map("mwan3", translate("MWAN Policy Configuration"), - translate(policyWarn())) + policyWarn()) m5:append(Template("mwan/config_css")) diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/policyconfig.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/policyconfig.lua index f48a104c6..06a0fec66 100644 --- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/policyconfig.lua +++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/policyconfig.lua @@ -9,7 +9,7 @@ end function policyWarn() -- display status and warning messages at the top of the page if nameTooLong == 1 then - return "WARNING: this policy's name is " .. policyNameLength .. " characters exceeding the maximum of 15!" + return "" .. translatef("WARNING: this policy's name is %d characters exceeding the maximum of 15!", policyNameLength) .. "" else return "" end @@ -32,8 +32,8 @@ nameTooLong = 0 policyCheck() -m5 = Map("mwan3", translate("MWAN Policy Configuration - " .. arg[1]), - translate(policyWarn())) +m5 = Map("mwan3", translatef("MWAN Policy Configuration - %s", arg[1]), + policyWarn()) m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "policy") diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/rule.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/rule.lua index a22e01054..412f369eb 100644 --- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/rule.lua +++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/rule.lua @@ -17,7 +17,7 @@ end function ruleWarn() -- display warning messages at the top of the page if error_protocol_list ~= " " then - return "WARNING: some rules have a port configured with no or improper protocol specified! Please configure a specific protocol!" + return "" .. translate("WARNING: some rules have a port configured with no or improper protocol specified! Please configure a specific protocol!") .. "" else return "" end @@ -34,7 +34,7 @@ ruleCheck() m5 = Map("mwan3", translate("MWAN Rule Configuration"), - translate(ruleWarn())) + ruleWarn()) m5:append(Template("mwan/config_css")) diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/ruleconfig.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/ruleconfig.lua index f7fb341e1..25a96f5c8 100644 --- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/ruleconfig.lua +++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/ruleconfig.lua @@ -13,7 +13,7 @@ end function ruleWarn() -- display warning message at the top of the page if error_protocol == 1 then - return "WARNING: this rule is incorrectly configured with no or improper protocol specified! Please configure a specific protocol!" + return "" .. translate("WARNING: this rule is incorrectly configured with no or improper protocol specified! Please configure a specific protocol!") .. "" else return "" end @@ -45,8 +45,8 @@ error_protocol = 0 ruleCheck() -m5 = Map("mwan3", translate("MWAN Rule Configuration - ") .. arg[1], - translate(ruleWarn())) +m5 = Map("mwan3", translatef("MWAN Rule Configuration - %s", arg[1]), + ruleWarn()) m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "rule")