gluon-web-network: improve PoE GPIO name translation handling
- Replace string concat for i18n key with an explicit list to make the code compatible with i18n-scan.pl - Improve fallback string
This commit is contained in:
parent
df5bf20b6c
commit
bab4af01eb
@ -19,6 +19,9 @@ msgstr "Automatisch (RA/DHCPv6)"
|
||||
msgid "Disabled"
|
||||
msgstr "Deaktiviert"
|
||||
|
||||
msgid "Enable \"%s\""
|
||||
msgstr "\"%s\" aktivieren"
|
||||
|
||||
msgid "Enable PoE Passthrough"
|
||||
msgstr "PoE-Passthrough aktivieren"
|
||||
|
||||
|
@ -19,6 +19,9 @@ msgstr "Automatique (RA/DHCPv6)"
|
||||
msgid "Disabled"
|
||||
msgstr "Désactivé"
|
||||
|
||||
msgid "Enable \"%s\""
|
||||
msgstr ""
|
||||
|
||||
msgid "Enable PoE Passthrough"
|
||||
msgstr ""
|
||||
|
||||
|
@ -10,6 +10,9 @@ msgstr ""
|
||||
msgid "Disabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "Enable \"%s\""
|
||||
msgstr ""
|
||||
|
||||
msgid "Enable PoE Passthrough"
|
||||
msgstr ""
|
||||
|
||||
|
@ -113,13 +113,23 @@ uci:foreach("system", "gpio_switch", function(si)
|
||||
section = f:section(Section)
|
||||
end
|
||||
|
||||
local port = si.name:match("^PoE Power Port(%d*)$")
|
||||
local texts = {
|
||||
["^PoE Power Port(%d*)$"] = function(m) return translatef("Enable PoE Power Port %s", m[1]) end,
|
||||
["^PoE Passthrough$"] = function() return translate("Enable PoE Passthrough") end,
|
||||
}
|
||||
|
||||
local name
|
||||
if port then
|
||||
name = translatef("Enable PoE Power Port %s", port)
|
||||
else
|
||||
name = translate("Enable " .. si.name)
|
||||
for pattern, f in pairs(texts) do
|
||||
local match = {si.name:match(pattern)}
|
||||
if match[1] then
|
||||
name = f(match)
|
||||
break
|
||||
end
|
||||
end
|
||||
if not name then
|
||||
name = translatef('Enable "%s"', si.name)
|
||||
end
|
||||
|
||||
local poe = section:option(Flag, si[".name"], name)
|
||||
poe.default = uci:get_bool("system", si[".name"], "value")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user