Skip to content
Snippets Groups Projects
Unverified Commit bab4af01 authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

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
parent df5bf20b
No related branches found
No related tags found
No related merge requests found
......@@ -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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment