From b76e1a9e485194fca2609dd0474180dc13388d47 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 4 May 2015 03:04:25 +0200 Subject: [PATCH] gluon-luci-wifi-config: i18n and miscellaneous fixes --- package/gluon-luci-wifi-config/Makefile | 8 ++- .../lua/luci/controller/admin/wifi-config.lua | 2 +- .../lua/luci/model/cbi/admin/wifi-config.lua | 63 ++++++++----------- package/gluon-luci-wifi-config/i18n/de.po | 32 ++++++++++ .../i18n/gluon-luci-wifi-config.pot | 20 ++++++ 5 files changed, 86 insertions(+), 39 deletions(-) create mode 100644 package/gluon-luci-wifi-config/i18n/de.po create mode 100644 package/gluon-luci-wifi-config/i18n/gluon-luci-wifi-config.pot diff --git a/package/gluon-luci-wifi-config/Makefile b/package/gluon-luci-wifi-config/Makefile index 2dd03f09..75e70863 100644 --- a/package/gluon-luci-wifi-config/Makefile +++ b/package/gluon-luci-wifi-config/Makefile @@ -1,12 +1,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-luci-wifi-config -PKG_VERSION:=0.1 +PKG_VERSION:=1 PKG_RELEASE:=1 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) -include $(INCLUDE_DIR)/package.mk +include $(GLUONDIR)/include/package.mk + +PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG) define Package/gluon-luci-wifi-config SECTION:=gluon @@ -23,10 +25,12 @@ define Build/Configure endef define Build/Compile + $(call GluonBuildI18N,gluon-luci-wifi-config,i18n) endef define Package/gluon-luci-wifi-config/install $(CP) ./files/* $(1)/ + $(call GluonInstallI18N,gluon-luci-wifi-config,$(1)) endef $(eval $(call BuildPackage,gluon-luci-wifi-config)) diff --git a/package/gluon-luci-wifi-config/files/usr/lib/lua/luci/controller/admin/wifi-config.lua b/package/gluon-luci-wifi-config/files/usr/lib/lua/luci/controller/admin/wifi-config.lua index 3bcb0007..2ff1cb84 100644 --- a/package/gluon-luci-wifi-config/files/usr/lib/lua/luci/controller/admin/wifi-config.lua +++ b/package/gluon-luci-wifi-config/files/usr/lib/lua/luci/controller/admin/wifi-config.lua @@ -1,5 +1,5 @@ module("luci.controller.admin.wifi-config", package.seeall) function index() - entry({"admin", "wifi-config"}, cbi("admin/wifi-config"), "WLAN", 20) + entry({"admin", "wifi-config"}, cbi("admin/wifi-config"), _("WLAN"), 20) end diff --git a/package/gluon-luci-wifi-config/files/usr/lib/lua/luci/model/cbi/admin/wifi-config.lua b/package/gluon-luci-wifi-config/files/usr/lib/lua/luci/model/cbi/admin/wifi-config.lua index d6559b51..1b8ef7c4 100644 --- a/package/gluon-luci-wifi-config/files/usr/lib/lua/luci/model/cbi/admin/wifi-config.lua +++ b/package/gluon-luci-wifi-config/files/usr/lib/lua/luci/model/cbi/admin/wifi-config.lua @@ -1,74 +1,65 @@ local f, s, o local uci = luci.model.uci.cursor() ---set the heading, button and stuff -f = SimpleForm("wifi", "WLAN-Config") -f.reset = false +f = SimpleForm("wifi", translate("WLAN")) f.template = "admin/expertmode" -f.submit = "Speichern" --- text, which describes what the package does to the user -s = f:section(SimpleSection, nil, [[ -In diesem Abschnitt hast du die Möglichkeit die SSIDs des Client- und des -Mesh-Netzes zu deaktivieren. Bitte lass die SSID des Mesh-Netzes aktiviert, -damit sich auch andere Knoten über dich mit dem Freifunk verbinden können. -]]) +s = f:section(SimpleSection, nil, translate( + "You can enable or disable your node's client and mesh network " + .. "SSIDs here. Please don't disable the mesh network without " + .. "a good reason, so other nodes can mesh with yours." +)) local radios = {} -- look for wifi interfaces and add them to the array uci:foreach('wireless', 'wifi-device', -function(s) - table.insert(radios, s['.name']) -end + function(s) + table.insert(radios, s['.name']) + end ) ---add a client and mesh checkbox for each interface -for index, radio in ipairs(radios) do - --get the hwmode to seperate 2.4GHz and 5Ghz radios +-- add a client and mesh checkbox for each interface +for _, radio in ipairs(radios) do local hwmode = uci:get('wireless', radio, 'hwmode') local p - if hwmode == '11g' or hwmode == '11ng' then --if 2.4GHz - - p = f:section(SimpleSection, "2,4GHz-WLAN", nil) - - elseif hwmode == '11a' or hwmode == '11na' then --if 5GHz - - p = f:section(SimpleSection, "5GHz-WLAN", nil) - + if hwmode == '11g' or hwmode == '11ng' then + p = f:section(SimpleSection, translate("2.4GHz WLAN")) + elseif hwmode == '11a' or hwmode == '11na' then + p = f:section(SimpleSection, translate("5GHz WLAN")) end if p then - --box for the clientnet - o = p:option(Flag, 'clientbox' .. index, "Client-Netz aktivieren") - o.default = (uci:get_bool('wireless', 'client_' .. radio, "disabled")) and o.disabled or o.enabled + --box for the client network + o = p:option(Flag, 'clientbox_' .. radio, translate("Enable client network")) + o.default = uci:get_bool('wireless', 'client_' .. radio, "disabled") and o.disabled or o.enabled o.rmempty = false - --box for the meshnet - o = p:option(Flag, 'meshbox' .. index, "Mesh-Netz aktivieren") - o.default = (uci:get_bool('wireless', 'mesh_' .. radio, "disabled")) and o.disabled or o.enabled + --box for the mesh network + o = p:option(Flag, 'meshbox_' .. radio, translate("Enable mesh network")) + o.default = uci:get_bool('wireless', 'mesh_' .. radio, "disabled") and o.disabled or o.enabled o.rmempty = false end end ---if the save-button is pushed +--when the save-button is pushed function f.handle(self, state, data) if state == FORM_VALID then - for index, radio in ipairs(radios) do + for _, radio in ipairs(radios) do local clientdisabled = 0 local meshdisabled = 0 - -- get the data from the boxes and invert it - if data["clientbox"..index] == '0' then + -- get and invert the data from the boxes + if data["clientbox_"..radio] == '0' then clientdisabled = 1 end -- write the data to the config file uci:set('wireless', 'client_' .. radio, "disabled", clientdisabled) - if data["meshbox"..index] == '0' then - meshdisabled = 1 + if data["meshbox_"..radio] == '0' then + meshdisabled = 1 end uci:set('wireless', 'mesh_' .. radio, "disabled", meshdisabled) diff --git a/package/gluon-luci-wifi-config/i18n/de.po b/package/gluon-luci-wifi-config/i18n/de.po new file mode 100644 index 00000000..6d51ccf1 --- /dev/null +++ b/package/gluon-luci-wifi-config/i18n/de.po @@ -0,0 +1,32 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"PO-Revision-Date: 2015-05-04 02:54+0200\n" +"Last-Translator: \n" +"Language-Team: German\n" +"Language: de\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 "2.4GHz WLAN" +msgstr "2,4GHz-WLAN" + +msgid "5GHz WLAN" +msgstr "5GHz-WLAN" + +msgid "Enable client network" +msgstr "Client-Netz aktivieren" + +msgid "Enable mesh network" +msgstr "Mesh-Netz aktivieren" + +msgid "" +"You can enable or disable your node's client and mesh network SSIDs here. " +"Please don't disable the mesh network without a good reason, so other nodes " +"can mesh with yours." +msgstr "" +"In diesem Abschnitt hast du die Möglichkeit, die SSIDs des Client- und des " +"Mesh-Netzes zu aktivieren bzw. deaktivieren. Bitte lass die SSID des Mesh-" +"Netzes aktiviert, damit sich andere Knoten mit deinem verbinden können." diff --git a/package/gluon-luci-wifi-config/i18n/gluon-luci-wifi-config.pot b/package/gluon-luci-wifi-config/i18n/gluon-luci-wifi-config.pot new file mode 100644 index 00000000..52dd7b66 --- /dev/null +++ b/package/gluon-luci-wifi-config/i18n/gluon-luci-wifi-config.pot @@ -0,0 +1,20 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "2.4GHz WLAN" +msgstr "" + +msgid "5GHz WLAN" +msgstr "" + +msgid "Enable client network" +msgstr "" + +msgid "Enable mesh network" +msgstr "" + +msgid "" +"You can enable or disable your node's client and mesh network SSIDs here. " +"Please don't disable the mesh network without a good reason, so other nodes " +"can mesh with yours." +msgstr ""