From 62fbd15ce1256786ffb78182eb90de84157bbce7 Mon Sep 17 00:00:00 2001 From: Bart Van Der Meerssche Date: Mon, 2 May 2011 16:37:56 +0200 Subject: [PATCH] [luci] provide an english .po file for the LuCI sensor page --- .../package/luci/i18n/english/Makefile | 2 +- .../luasrc/controller/mini/sensor.lua | 2 +- .../luasrc/model/cbi/mini/sensor.lua | 39 ++++---- mote/v2/openwrt/package/luci/po/en/sensor.po | 94 +++++++++++++++++++ 4 files changed, 116 insertions(+), 21 deletions(-) create mode 100644 mote/v2/openwrt/package/luci/po/en/sensor.po diff --git a/mote/v2/openwrt/package/luci/i18n/english/Makefile b/mote/v2/openwrt/package/luci/i18n/english/Makefile index fddd705..e497aec 100644 --- a/mote/v2/openwrt/package/luci/i18n/english/Makefile +++ b/mote/v2/openwrt/package/luci/i18n/english/Makefile @@ -1,4 +1,4 @@ -PO = default cbi admin-core sysauth wifi +PO = default cbi admin-core sysauth wifi sensor PO_LANG = en include ../../build/config.mk diff --git a/mote/v2/openwrt/package/luci/modules/admin-mini/luasrc/controller/mini/sensor.lua b/mote/v2/openwrt/package/luci/modules/admin-mini/luasrc/controller/mini/sensor.lua index ddd1a41..93fd4f8 100644 --- a/mote/v2/openwrt/package/luci/modules/admin-mini/luasrc/controller/mini/sensor.lua +++ b/mote/v2/openwrt/package/luci/modules/admin-mini/luasrc/controller/mini/sensor.lua @@ -20,5 +20,5 @@ function index() luci.i18n.loadc("admin-core") local i18n = luci.i18n.translate - entry({"sensor"}, cbi("mini/sensor", {autoapply=true}), i18n("sensor"), 1) + entry({"sensor"}, cbi("mini/sensor", {autoapply=true}), i18n("sensor"), 1).i18n="sensor" end diff --git a/mote/v2/openwrt/package/luci/modules/admin-mini/luasrc/model/cbi/mini/sensor.lua b/mote/v2/openwrt/package/luci/modules/admin-mini/luasrc/model/cbi/mini/sensor.lua index 6c31a1a..5332492 100644 --- a/mote/v2/openwrt/package/luci/modules/admin-mini/luasrc/model/cbi/mini/sensor.lua +++ b/mote/v2/openwrt/package/luci/modules/admin-mini/luasrc/model/cbi/mini/sensor.lua @@ -26,19 +26,20 @@ local FLUKSO = uci:get_all("flukso") local MAX_SENSORS = tonumber(FLUKSO.main.max_sensors) -m = Map("flukso", translate("Sensor"), translate("Fluksometer sensor configuration")) +m = Map("flukso", translate("flm_sensor"), translate("flm_sensor_settings")) -s = m:section(NamedSection, "daemon", "settings", "service configuration") -wan_enable = s:option(Flag, "enable_wan_branch", translate("wan_enable")) +s = m:section(NamedSection, "daemon", "settings", translate("flm_service_config")) +wan_enable = s:option(Flag, "enable_wan_branch", translate("flm_wan")) wan_enable.rmempty = false -lan_enable = s:option(Flag, "enable_lan_branch", translate("lan_enable")) +lan_enable = s:option(Flag, "enable_lan_branch", translate("flm_lan")) lan_enable.rmempty = false -s = m:section(NamedSection, "main", "settings", "analog port configuration") -phase = s:option(ListValue, "phase", translate("phase")) +s = m:section(NamedSection, "main", "settings", translate("flm_ct_setup")) +phase = s:option(ListValue, "phase", translate("flm_phase")) phase:value("1") phase:value("3") +phase.description = translate("flm_ct_descr") -- (ab)use phase validation callback to assgn port numbers to sensors function phase:validate(value, section) @@ -61,26 +62,26 @@ function phase:validate(value, section) end for i = 1, MAX_SENSORS do - s = m:section(NamedSection, tostring(i), "sensor", "sensor #" .. i) + s = m:section(NamedSection, tostring(i), "sensor", translate("flm_sensor_num") .. i) s.addremove = false - enable = s:option(Flag, "enable", translate("enable")) + enable = s:option(Flag, "enable", translate("flm_enable")) enable.rmempty = false - s:option(DummyValue, "id", translate("identifier")) - s:option(DummyValue, "class", translate("class")) + s:option(DummyValue, "id", translate("flm_id")) + s:option(DummyValue, "class", translate("flm_class")) if FLUKSO[tostring(i)].class == "analog" then - typ = s:option(DummyValue, "type", translate("type")) + typ = s:option(DummyValue, "type", translate("flm_type")) - func = s:option(Value, "function", translate("function")) + func = s:option(Value, "function", translate("flm_function")) func:depends("enable", "1") func.rmempty = true - voltage = s:option(Value, "voltage", translate("voltage")) + voltage = s:option(Value, "voltage", translate("flm_voltage")) voltage.rmempty = false - current = s:option(ListValue, "current", translate("current")) + current = s:option(ListValue, "current", translate("flm_current")) current:value("50") current:value("100") current:value("250") @@ -88,14 +89,14 @@ for i = 1, MAX_SENSORS do current.rmempty = false elseif FLUKSO[tostring(i)].class == "pulse" then - typ = s:option(Value, "type", translate("type")) + typ = s:option(Value, "type", translate("flm_type")) typ.rmempty = true - func = s:option(Value, "function", translate("function")) + func = s:option(Value, "function", translate("flm_function")) func:depends("enable", "1") func.rmempty = true - constant = s:option(Value, "constant", translate("constant")) + constant = s:option(Value, "constant", translate("flm_constant")) constant.rmempty = false end end @@ -123,7 +124,7 @@ function m:parse(...) and field["enable"]:formvalue(sid) == "1" and field["function"]:formvalue(sid) == "" then - err[#err + 1] = "an enabled sensor must have a name" + err[#err + 1] = translate("flm_err_no_name") end -- an enabled sensor requires a non-empty type @@ -131,7 +132,7 @@ function m:parse(...) and field["enable"]:formvalue(sid) == "1" and field["type"]:formvalue(sid) == "" then - err[#err + 1] = "an enabled sensor must have a type" + err[#err + 1] = translate("flm_err_no_type") end if next(err) then diff --git a/mote/v2/openwrt/package/luci/po/en/sensor.po b/mote/v2/openwrt/package/luci/po/en/sensor.po new file mode 100644 index 0000000..570493f --- /dev/null +++ b/mote/v2/openwrt/package/luci/po/en/sensor.po @@ -0,0 +1,94 @@ +#. Sensor +#: i18n/english/luasrc/i18n/sensor.en.lua:1 +msgid "flm_sensor" +msgstr "Sensor" + +#. Please configure all the sensors you wish to use on this Fluksometer. +#: i18n/english/luasrc/i18n/sensor.en.lua:2 +msgid "flm_sensor_settings" +msgstr "Please configure all the sensors you wish to use on this Fluksometer." + +#. Services +#: i18n/english/luasrc/i18n/sensor.en.lua:3 +msgid "flm_service_config" +msgstr "Services" + +#. Report to Flukso platform +#: i18n/english/luasrc/i18n/sensor.en.lua:4 +msgid "flm_wan" +msgstr "Report measurements to the Flukso platform" + +#. Enable local JSON/REST API +#: i18n/english/luasrc/i18n/sensor.en.lua:5 +msgid "flm_lan" +msgstr "Enable the local JSON/REST API" + +#. Current clamp setup +#: i18n/english/luasrc/i18n/sensor.en.lua:6 +msgid "flm_ct_setup" +msgstr "Current clamp setup" + +#. Number of phases +#: i18n/english/luasrc/i18n/sensor.en.lua:7 +msgid "flm_phase" +msgstr "Number of phases" + +#. Sensor # +#: i18n/english/luasrc/i18n/sensor.en.lua:8 +msgid "flm_sensor_num" +msgstr "Sensor #" + +#. Enable +#: i18n/english/luasrc/i18n/sensor.en.lua:9 +msgid "flm_enable" +msgstr "Enable" + +#. Identification +#: i18n/english/luasrc/i18n/sensor.en.lua:10 +msgid "flm_id" +msgstr "Identification" + +#. Class +#: i18n/english/luasrc/i18n/sensor.en.lua:11 +msgid "flm_class" +msgstr "Class" + +#. Type +#: i18n/english/luasrc/i18n/sensor.en.lua:12 +msgid "flm_type" +msgstr "Type" + +#. Function/Name +#: i18n/english/luasrc/i18n/sensor.en.lua:13 +msgid "flm_function" +msgstr "Function/Name" + +#. Voltage +#: i18n/english/luasrc/i18n/sensor.en.lua:14 +msgid "flm_voltage" +msgstr "Voltage" + +#. Current +#: i18n/english/luasrc/i18n/sensor.en.lua:15 +msgid "flm_current" +msgstr "Current" + +#. Constant +#: i18n/english/luasrc/i18n/sensor.en.lua:16 +msgid "flm_constant" +msgstr "Constant" + +#. An enabled sensor should have a function/name assigned. +#: i18n/english/luasrc/i18n/sensor.en.lua:17 +msgid "flm_err_no_name" +msgstr "An enabled sensor should have a function/name assigned." + +#. An enabled sensor should have a type assigned. +#: i18n/english/luasrc/i18n/sensor.en.lua:18 +msgid "flm_err_no_type" +msgstr "An enabled sensor should have a type assigned." + +#. When selecting 3 phases, the three clamp inputs will be grouped and presented as a single sensor #1. Sensors #2 and #3 will be disabled automatically after saving. When selecting 1 phase, each clamp input will be sampled seperately and mapped to sensors #1, #2 and #3 respectively. +#: i18n/english/luasrc/i18n/sensor.en.lua:19 +msgid "flm_ct_descr" +msgstr "When selecting 3 phases, the three clamp inputs will be grouped and presented as a single sensor #1. Sensors #2 and #3 will be disabled automatically after saving. When selecting 1 phase, each clamp input will be sampled seperately and mapped to sensors #1, #2 and #3 respectively."