Commit 8fe70a00 authored by nrb's avatar nrb

gluon-config-mode-zip: i18n: fix translations

Use the correct translation namespace. As we run in gluon config mode,
we do not have our own controller. Thus we need to specify the
translation namespace for gluon to find translations. See
<https://gluon.readthedocs.io/en/stable/dev/web/i18n.html>:

> Note that translations are namespaced: each package will only use its
> own translation strings by default. For this purpose, the package name
> must by specified in a package’s controller. It is possible to access
> a different translation package using the i18n function from models
> and view, which is necessary when strings from the site configuration
> are used, or packages do not have their own controller (which is the
> case for config mode wizard components).
>
>     local site_i18n = i18n 'gluon-site'
>     local msg = site_i18n._translate('gluon-config-mode:welcome')
>
parent cb5fd4bb
return function(form, uci)
local location = uci:get_first("gluon-node-info", "location")
local text = translate("gluon-config-mode:zip-help")
local site_i18n = i18n 'gluon-site'
local text = site_i18n.translate("gluon-config-mode:zip-help")
local s = form:section(Section, nil, text)
local o = s:option(Value, "zip", translate("ZIP-Code"), translatef("e.g. %s", "70499"))
local o = s:option(Value, "zip", site_i18n.translate("ZIP-Code"), site_i18n.translatef("e.g. %s", "70499"))
o.default = uci:get("gluon-node-info", location, "zip")
o.datatype = "uinteger"
o.optional = true
......@@ -14,4 +15,4 @@ return function(form, uci)
end
return {'gluon-node-info'}
end
\ No newline at end of file
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment