diff --git a/gluon-config-mode-zip/i18n/de.po b/gluon-config-mode-zip/i18n/de.po index fe349327ba3279a79cf654ddcf73bba4ca9006ac..212a21836d6095d9bd195fdc15315839a0d00b5b 100644 --- a/gluon-config-mode-zip/i18n/de.po +++ b/gluon-config-mode-zip/i18n/de.po @@ -11,11 +11,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "gluon-config-mode:zip-help" -"Some nice Text about the ZIP-Code " -"and how it help for subnetting." -msgstr "" -"Ein Netter Text warum die PLZ benötigt " -"wird." +msgstr "Ein Netter Text warum die PLZ benötigt wird." msgid "ZIP-Code" msgstr "PLZ" diff --git a/gluon-config-mode-zip/i18n/en.po b/gluon-config-mode-zip/i18n/en.po new file mode 100644 index 0000000000000000000000000000000000000000..aa2b2bf9b23b7062a253e1ea77691366fab1e47f --- /dev/null +++ b/gluon-config-mode-zip/i18n/en.po @@ -0,0 +1,21 @@ +msgid "" +msgstr "" +"Project-Id-Version: gluon-config-mode-zip\n" +"PO-Revision-Date: 2017-02-17 02:18+0100\n" +"Last-Translator: Philippe Käufer <freifunk@philhil.de>\n" +"Language-Team: English\n" +"Language: en\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgid "gluon-config-mode:zip-help" +msgstr "Some nice Text about the ZIP-Code " +"and how it help for subnetting." + +msgid "ZIP-Code" +msgstr "ZIP-Code" + +msgid "e.g. %s" +msgstr "e.g. %s" diff --git a/gluon-config-mode-zip/i18n/gluon-config-mode-zip.pot b/gluon-config-mode-zip/i18n/gluon-config-mode-zip.pot index 64d409fc25d674d06e906cb21fa0dafc047357e5..94d2986c10fcf6b2140b230b67ca56b56c6105a9 100644 --- a/gluon-config-mode-zip/i18n/gluon-config-mode-zip.pot +++ b/gluon-config-mode-zip/i18n/gluon-config-mode-zip.pot @@ -2,8 +2,6 @@ msgid "" msgstr "Content-Type: text/plain; charset=UTF-8" msgid "gluon-config-mode:zip-help" -"Some nice Text about the ZIP-Code " -"and how it help for subnetting." msgstr "" msgid "ZIP-Code" diff --git a/gluon-config-mode-zip/luasrc/lib/gluon/config-mode/wizard/0450-geo-location.lua b/gluon-config-mode-zip/luasrc/lib/gluon/config-mode/wizard/0450-geo-location.lua index 3ce1e7df55cb5bc433fc9a40f6bc142e80401435..b71ffd8307bb8a9da0ab8b590e53f47364d7513c 100644 --- a/gluon-config-mode-zip/luasrc/lib/gluon/config-mode/wizard/0450-geo-location.lua +++ b/gluon-config-mode-zip/luasrc/lib/gluon/config-mode/wizard/0450-geo-location.lua @@ -5,23 +5,27 @@ local uci = luci.model.uci.cursor() local M = {} function M.section(form) - local text = i18n.translate("gluon-config-mode:zip-help") + local text = i18n.translate("gluon-config-mode:zip-help") + local fieldlabel = i18n.translate("ZIP-Code") + local s = form:section(cbi.SimpleSection, nil, text) - local s = form:section(cbi.SimpleSection, nil, text) - - local o = s:option(cbi.Value, "_zip", "ZIP-Code") - o.value = uci:get_first("gluon-node-info", "location", "zip") - o.rmempty = false - o.datatype = "float" - o.description = i18n.translatef("e.g. %s", "70499") + local o = s:option(cbi.Value, "_zip", fieldlabel) + o.value = uci:get_first("gluon-node-info", "location", "zip") + o.rmempty = true + o.datatype = "float" + o.description = i18n.translatef("e.g. %s", "70499") end function M.handle(data) - local sname = uci:get_first("gluon-node-info", "location") - uci:set("gluon-node-info", sname, "zip", data._zip:trim()) + local sname = uci:get_first("gluon-node-info", "location") + + if data._zip ~= nil then + uci:set("gluon-node-info", sname, "zip", data._zip:trim()) + else + uci:delete("gluon-node-info", sname, "zip") + end uci:save("gluon-node-info") - uci:commit("gluon-node-info") - + uci:commit("gluon-node-info") end return M