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

gluon-web: add i18n package namespaces

parent 1a426c3b
No related branches found
No related tags found
No related merge requests found
Showing
with 77 additions and 30 deletions
return function(form, uci)
local pkg_i18n = i18n 'gluon-config-mode-autoupdater'
local enabled = uci:get_bool("autoupdater", "settings", "enabled")
if enabled then
form:section(
Section, nil,
translate('This node will automatically update its firmware when a new version is available.')
pkg_i18n.translate('This node will automatically update its firmware when a new version is available.')
)
else
form:section(
Section, nil,
translate('Automatic updates are disabled. They can be enabled in <em>Advanced settings</em>.')
pkg_i18n.translate('Automatic updates are disabled. They can be enabled in <em>Advanced settings</em>.')
)
end
end
return function(form, uci)
local pkg_i18n = i18n 'gluon-config-mode-contact-info'
local site = require 'gluon.site'
local owner = uci:get_first("gluon-node-info", "owner")
local s = form:section(Section, nil, translate(
local s = form:section(Section, nil, pkg_i18n.translate(
'Please provide your contact information here to '
.. 'allow others to contact you. Note that '
.. 'this information will be visible <em>publicly</em> '
.. 'on the internet together with your node\'s coordinates.'
))
local o = s:option(Value, "contact", translate("Contact info"), translate("e.g. E-mail or phone number"))
local o = s:option(Value, "contact", pkg_i18n.translate("Contact info"), pkg_i18n.translate("e.g. E-mail or phone number"))
o.default = uci:get("gluon-node-info", owner, "contact")
o.optional = not site.config_mode.owner.obligatory(false)
-- without a minimal length, an empty string will be accepted even with "optional = false"
......
<%-
local site_i18n = i18n 'gluon-site'
local sysconfig = require 'gluon.sysconfig'
local msg = _translate('gluon-config-mode:welcome')
local msg = site_i18n._translate('gluon-config-mode:welcome')
if not msg then return end
-%>
<p>
......
local site_i18n = i18n 'gluon-site'
local site = require 'gluon.site'
local sysconfig = require 'gluon.sysconfig'
local pretty_hostname = require 'pretty_hostname'
......@@ -7,7 +9,7 @@ local uci = require("simple-uci").cursor()
local hostname = pretty_hostname.get(uci)
local contact = uci:get_first('gluon-node-info', 'owner', 'contact')
local msg = _translate('gluon-config-mode:reboot')
local msg = site_i18n._translate('gluon-config-mode:reboot')
if not msg then return end
renderer.render_string(msg, {
......
package 'gluon-config-mode-core'
entry({}, alias("wizard"))
entry({"wizard"}, model("gluon-config-mode/wizard"), _("Wizard"), 5)
......@@ -26,6 +26,7 @@ f.reset = false
local s = f:section(Section)
s.template = "gluon/config-mode/welcome"
s.package = "gluon-config-mode-core"
local commit = {'gluon-setup-mode'}
local run = {}
......@@ -57,6 +58,7 @@ function f:write()
end
f.template = "gluon/config-mode/reboot"
f.package = "gluon-config-mode-core"
f.hidenav = true
if nixio.fork() == 0 then
......
return function(form, uci)
local site_i18n = i18n 'gluon-site'
local fs = require 'nixio.fs'
local json = require 'jsonc'
local site = require 'gluon.site'
......@@ -24,8 +26,8 @@ return function(form, uci)
return list
end
local s = form:section(Section, nil, translate('gluon-config-mode:domain-select'))
local o = s:option(ListValue, 'domain', translate('gluon-config-mode:domain'))
local s = form:section(Section, nil, site_i18n.translate('gluon-config-mode:domain-select'))
local o = s:option(ListValue, 'domain', site_i18n.translate('gluon-config-mode:domain'))
if configured then
o.default = selected_domain
......
return function(form, uci)
local pkg_i18n = i18n 'gluon-config-mode-geo-location'
local site_i18n = i18n 'gluon-site'
local site = require 'gluon.site'
local location = uci:get_first("gluon-node-info", "location")
......@@ -11,25 +14,25 @@ return function(form, uci)
return uci:get_bool("gluon-node-info", location, "altitude")
end
local text = translate(
local text = pkg_i18n.translate(
'If you want the location of your node to ' ..
'be displayed on the map, you can enter its coordinates here.'
)
if show_altitude() then
text = text .. ' ' .. translate("gluon-config-mode:altitude-help")
text = text .. ' ' .. site_i18n.translate("gluon-config-mode:altitude-help")
end
local s = form:section(Section, nil, text)
local o
local share_location = s:option(Flag, "location", translate("Show node on the map"))
local share_location = s:option(Flag, "location", pkg_i18n.translate("Show node on the map"))
share_location.default = uci:get_bool("gluon-node-info", location, "share_location")
function share_location:write(data)
uci:set("gluon-node-info", location, "share_location", data)
end
o = s:option(Value, "latitude", translate("Latitude"), translatef("e.g. %s", "53.873621"))
o = s:option(Value, "latitude", pkg_i18n.translate("Latitude"), pkg_i18n.translatef("e.g. %s", "53.873621"))
o.default = uci:get("gluon-node-info", location, "latitude")
o:depends(share_location, true)
o.datatype = "float"
......@@ -37,7 +40,7 @@ return function(form, uci)
uci:set("gluon-node-info", location, "latitude", data)
end
o = s:option(Value, "longitude", translate("Longitude"), translatef("e.g. %s", "10.689901"))
o = s:option(Value, "longitude", pkg_i18n.translate("Longitude"), pkg_i18n.translatef("e.g. %s", "10.689901"))
o.default = uci:get("gluon-node-info", location, "longitude")
o:depends(share_location, true)
o.datatype = "float"
......@@ -46,7 +49,7 @@ return function(form, uci)
end
if show_altitude() then
o = s:option(Value, "altitude", translate("gluon-config-mode:altitude-label"), translatef("e.g. %s", "11.51"))
o = s:option(Value, "altitude", site_i18n.translate("gluon-config-mode:altitude-label"), pkg_i18n.translatef("e.g. %s", "11.51"))
o.default = uci:get("gluon-node-info", location, "altitude")
o:depends(share_location, true)
o.datatype = "float"
......
return function(form, uci)
local pkg_i18n = i18n 'gluon-config-mode-hostname'
local pretty_hostname = require "pretty_hostname"
local s = form:section(Section)
local o = s:option(Value, "hostname", translate("Node name"))
local o = s:option(Value, "hostname", pkg_i18n.translate("Node name"))
o.default = pretty_hostname.get(uci)
function o:write(data)
......
local site_i18n = i18n 'gluon-site'
local uci = require("simple-uci").cursor()
local lutil = require "gluon.web.util"
local fs = require "nixio.fs"
......@@ -23,15 +25,15 @@ local msg
if has_tunneldigger then
local tunneldigger_enabled = uci:get_bool("tunneldigger", "mesh_vpn", "enabled")
if not tunneldigger_enabled then
msg = _translate('gluon-config-mode:novpn')
msg = site_i18n._translate('gluon-config-mode:novpn')
end
elseif has_fastd then
local fastd_enabled = uci:get_bool("fastd", "mesh_vpn", "enabled")
if fastd_enabled then
pubkey = util.trim(lutil.exec("/etc/init.d/fastd show_key mesh_vpn"))
msg = _translate('gluon-config-mode:pubkey')
msg = site_i18n._translate('gluon-config-mode:pubkey')
else
msg = _translate('gluon-config-mode:novpn')
msg = site_i18n._translate('gluon-config-mode:novpn')
end
end
......
......@@ -8,7 +8,9 @@ return function(form, uci)
return
end
local msg = translate(
local pkg_i18n = i18n 'gluon-config-mode-mesh-vpn'
local msg = pkg_i18n.translate(
'Your internet connection can be used to establish a ' ..
'VPN connection with other nodes. ' ..
'Enable this option if there are no other nodes reachable ' ..
......@@ -21,7 +23,7 @@ return function(form, uci)
local o
local meshvpn = s:option(Flag, "meshvpn", translate("Use internet connection (mesh VPN)"))
local meshvpn = s:option(Flag, "meshvpn", pkg_i18n.translate("Use internet connection (mesh VPN)"))
meshvpn.default = uci:get_bool("fastd", "mesh_vpn", "enabled") or uci:get_bool("tunneldigger", "mesh_vpn", "enabled")
function meshvpn:write(data)
if has_fastd then
......@@ -32,7 +34,7 @@ return function(form, uci)
end
end
local limit = s:option(Flag, "limit_enabled", translate("Limit bandwidth"))
local limit = s:option(Flag, "limit_enabled", pkg_i18n.translate("Limit bandwidth"))
limit:depends(meshvpn, true)
limit.default = uci:get_bool("simple-tc", "mesh_vpn", "enabled")
function limit:write(data)
......@@ -41,7 +43,7 @@ return function(form, uci)
uci:set("simple-tc", "mesh_vpn", "ifname", "mesh-vpn")
end
o = s:option(Value, "limit_ingress", translate("Downstream (kbit/s)"))
o = s:option(Value, "limit_ingress", pkg_i18n.translate("Downstream (kbit/s)"))
o:depends(limit, true)
o.default = uci:get("simple-tc", "mesh_vpn", "limit_ingress")
o.datatype = "uinteger"
......@@ -49,7 +51,7 @@ return function(form, uci)
uci:set("simple-tc", "mesh_vpn", "limit_ingress", data)
end
o = s:option(Value, "limit_egress", translate("Upstream (kbit/s)"))
o = s:option(Value, "limit_egress", pkg_i18n.translate("Upstream (kbit/s)"))
o:depends(limit, true)
o.default = uci:get("simple-tc", "mesh_vpn", "limit_egress")
o.datatype = "uinteger"
......
package 'gluon-web-admin'
local root = node()
if not root.target then
root.target = alias("admin")
......
......@@ -9,6 +9,9 @@ You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
]]--
package 'gluon-web-admin'
local fs = require 'nixio.fs'
local tmpfile = "/tmp/firmware.img"
......@@ -106,17 +109,23 @@ local function action_upgrade(http, renderer)
renderer.render("layout", {
content = "admin/upgrade",
bad_image = has_image and not has_support,
env = {
bad_image = has_image and not has_support,
},
pkg = 'gluon-web-admin',
})
-- Step 2: present uploaded file, show checksum, confirmation
elseif step == 2 then
renderer.render("layout", {
content = "admin/upgrade_confirm",
checksum = image_checksum(tmpfile),
filesize = fs.stat(tmpfile).size,
flashsize = storage_size(),
keepconfig = (http:formvalue("keepcfg") == "1"),
env = {
checksum = image_checksum(tmpfile),
filesize = fs.stat(tmpfile).size,
flashsize = storage_size(),
keepconfig = (http:formvalue("keepcfg") == "1"),
},
pkg = 'gluon-web-admin',
})
elseif step == 3 then
if http:formvalue("keepcfg") == "1" then
......@@ -127,6 +136,7 @@ local function action_upgrade(http, renderer)
renderer.render("layout", {
content = "admin/upgrade_reboot",
hidenav = true,
pkg = 'gluon-web-admin',
})
end
end
......
package 'gluon-web-autoupdater'
entry({"admin", "autoupdater"}, model("admin/autoupdater"), _("Automatic updates"), 80)
package 'gluon-web-logging'
entry({"admin", "logging"}, model("admin/logging"), _("Logging"), 85)
......@@ -26,14 +26,14 @@ define Build/Configure
endef
define Build/Compile
$(call GluonBuildI18N,gluon-mesh-vpn-fastd,i18n)
$(call GluonBuildI18N,gluon-web-mesh-vpn-fastd,i18n)
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
endef
define Package/gluon-web-mesh-vpn-fastd/install
$(CP) ./files/* $(1)/
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
$(call GluonInstallI18N,gluon-mesh-vpn-fastd,$(1))
$(call GluonInstallI18N,gluon-web-mesh-vpn-fastd,$(1))
endef
define Package/gluon-web-mesh-vpn-fastd/postinst
......
package 'gluon-web-mesh-vpn-fastd'
entry({"admin", "mesh_vpn_fastd"}, model("admin/mesh_vpn_fastd"), _("Mesh VPN"), 50)
......@@ -6,6 +6,7 @@ local f = Form(translate('Mesh VPN'))
local s = f:section(Section)
local mode = s:option(Value, 'mode')
mode.package = "gluon-web-mesh-vpn-fastd"
mode.template = "gluon/model/mesh-vpn-fastd"
local methods = uci:get('fastd', 'mesh_vpn', 'method')
......
package 'gluon-web-network'
entry({"admin", "network"}, model("admin/network"), _("Network"), 40)
package 'gluon-web-node-role'
entry({"admin", "noderole"}, model("admin/noderole"), "Node role", 60)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment