From 2623e2880c69e5e19891ad06759dcbb8ad62f91b Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Sat, 31 May 2008 08:04:49 +0000 Subject: [PATCH] * Core translation part 1 * Introduced new default theme "OpenWRT.org" * Minor tweaks --- contrib/package/luci/Makefile | 20 +- i18n/english/luasrc/i18n/admin-core.en | 37 +++ i18n/english/luasrc/i18n/default.en | 27 ++ libs/web/luasrc/dispatcher.lua | 17 +- libs/web/root/etc/config/luci | 21 +- .../luasrc/controller/admin/index.lua | 12 +- .../luasrc/controller/admin/status.lua | 7 +- .../luasrc/controller/admin/system.lua | 19 +- modules/admin-core/luasrc/i18n/admin_index.en | 20 -- modules/admin-core/luasrc/view/about.htm | 12 +- .../luasrc/view/admin_index/index.htm | 16 +- .../luasrc/view/admin_status/index.htm | 4 +- .../luasrc/view/themes/fledermaus/header.htm | 5 +- themes/openwrt.org/Makefile | 2 + .../luasrc/view/themes/openwrt.org/footer.htm | 8 + .../luasrc/view/themes/openwrt.org/header.htm | 136 ++++++++ .../www/luci-static/openwrt.org/cascade.css | 298 ++++++++++++++++++ 17 files changed, 591 insertions(+), 70 deletions(-) create mode 100644 i18n/english/luasrc/i18n/admin-core.en create mode 100644 i18n/english/luasrc/i18n/default.en delete mode 100644 modules/admin-core/luasrc/i18n/admin_index.en create mode 100644 themes/openwrt.org/Makefile create mode 100644 themes/openwrt.org/luasrc/view/themes/openwrt.org/footer.htm create mode 100644 themes/openwrt.org/luasrc/view/themes/openwrt.org/header.htm create mode 100644 themes/openwrt.org/root/www/luci-static/openwrt.org/cascade.css diff --git a/contrib/package/luci/Makefile b/contrib/package/luci/Makefile index fc0e468eae..39f08c4e9c 100644 --- a/contrib/package/luci/Makefile +++ b/contrib/package/luci/Makefile @@ -132,6 +132,7 @@ define Package/luci-ff-halle DEPENDS+= \ +luci-sgi-haserl +luci-app-splash \ +luci-app-ffwizard-leipzig \ + +luci-theme-fledermaus \ +olsrd +olsrd-mod-dyn-gw +olsrd-mod-txtinfo +olsrd-mod-nameservice \ +kmod-tun +ip TITLE:=Freifunk Halle Community Meta-Package @@ -148,6 +149,7 @@ define Package/luci-ff-leipzig DEPENDS+= \ +luci-sgi-haserl +luci-app-splash \ +luci-app-ffwizard-leipzig \ + +luci-theme-fledermaus \ +olsrd +olsrd-mod-dyn-gw +olsrd-mod-txtinfo +olsrd-mod-nameservice \ +kmod-tun +ip TITLE:=Freifunk Leipzig Community Meta-Package @@ -163,6 +165,7 @@ define Package/luci-ff-hannover $(call Package/luci/fftemplate) DEPENDS+= \ +luci-sgi-haserl +luci-app-splash \ + +luci-theme-fledermaus \ +olsrd +olsrd-mod-dyn-gw +olsrd-mod-txtinfo +olsrd-mod-nameservice TITLE:=Freifunk Hannover Community Meta-Package URL:=http://www.freifunk-hannover.de/ @@ -179,7 +182,7 @@ endef define Package/luci-mod-admin-core $(call Package/luci/webtemplate) - DEPENDS+=+luci-web +luci-cbi +luci-theme-fledermaus + DEPENDS+=+luci-web +luci-cbi +luci-theme-openwrt TITLE:=Administration module endef @@ -297,13 +300,22 @@ endef ### Templates ### define Package/luci-theme-fledermaus $(call Package/luci/thtemplate) - TITLE:=Fledermaus (default) + TITLE:=Fledermaus (Freifunk theme) endef define Package/luci-theme-fledermaus/install $(call Package/luci/install/template,$(1),themes/fledermaus) endef +define Package/luci-theme-openwrt + $(call Package/luci/thtemplate) + TITLE:=OpenWRT.org (default) +endef + +define Package/luci-theme-openwrt/install + $(call Package/luci/install/template,$(1),themes/openwrt.org) +endef + ### Compile ### ifneq ($(CONFIG_PACKAGE_luci-core),) @@ -356,6 +368,9 @@ endif ifneq ($(CONFIG_PACKAGE_luci-theme-fledermaus),) PKG_SELECTED_MODULES+=themes/fledermaus endif +ifneq ($(CONFIG_PACKAGE_luci-theme-openwrt),) + PKG_SELECTED_MODULES+=themes/openwrt.org +endif $(eval $(call BuildPackage,luci-core)) @@ -378,3 +393,4 @@ $(eval $(call BuildPackage,luci-sgi-haserl)) $(eval $(call BuildPackage,luci-sgi-webuci)) $(eval $(call BuildPackage,luci-theme-fledermaus)) +$(eval $(call BuildPackage,luci-theme-openwrt)) diff --git a/i18n/english/luasrc/i18n/admin-core.en b/i18n/english/luasrc/i18n/admin-core.en new file mode 100644 index 0000000000..2e96bdb506 --- /dev/null +++ b/i18n/english/luasrc/i18n/admin-core.en @@ -0,0 +1,37 @@ +a_i_ui = "User Interface" + +c_lucidesc = [[LuCI is a free Lua library with integrated MVC-Webframework and webinterface for embedded devices, +aspecially routers that run OpenWRT. Luci is licensed under the Apache-License.]] +c_projecthome = "Project Homepage" +c_leaddev = "Lead Development" +c_contributors = "Contributing Developers" +c_thanksto = "Thanks To" + +a_i_i_hello = "Hello!" +a_i_i_admin1 = "This is the administration area of LuCI." +a_i_i_admin2 = "LuCI is a free, flexible, and user friendly graphical interface for configuring OpenWRT Kamikaze." +a_i_i_admin3 = "On the following pages you can adjust all important settings of your router." +a_i_i_admin4 = "You will find a navigation leading to the different configuration pages on the left side." +a_i_i_admin5 = [[As we are always want to improve this interface we are looking forward +to your feedback and suggestions.]] +a_i_i_admin6 = "And now have fun with your router!" +a_i_i_team = "The LuCI Team" + +a_i_status1 = [[Here you can find information about the current system status like CPU clock frequency, memory +usage or network interface data.]] +a_i_status2 = [[Also kernel or service logfiles can be viewed here to get an overview over their current state.]] + +a_s_packages = "Software" +a_s_changepw = "Admin Password" +a_s_ipkg = "IPKG-Configuration" +a_s_sshkeys = "SSH-Keys" +a_s_fstab = "Mount Points" + +luci1 = "Here you can customize the settings and the functionality of LuCI." +language = "Language" +general = "General" +ucicommit = "Post-commit actions" +ucicommit1 = [[These commands will be executed automatically when a given UCI configuration is committed allowing +changes to be applied instantly.]] +keepflash = "Files to be kept when flashing a new firmware" +keepflash1 = "When flashing a new firmware with LuCI these files will be added to the new firmware installation." \ No newline at end of file diff --git a/i18n/english/luasrc/i18n/default.en b/i18n/english/luasrc/i18n/default.en new file mode 100644 index 0000000000..a387c5e1ca --- /dev/null +++ b/i18n/english/luasrc/i18n/default.en @@ -0,0 +1,27 @@ +about = "About" +add = "Add" +administration = "Administration" +apply = "Apply" + +changes = "Changes" +config = "Configuration" + +fwupgrade = "Firmware Upgrade" + +hostname = "Hostname" + +load = "Load" + +overview = "Overview" +packagemanager = "Package Manager" +path = "Path" + +reset = "Reset" +revert = "Revert" + +save = "Save" +statistics = "Statistics" +syslog = "System Log" +system = "System" + +webui = "Web UI" \ No newline at end of file diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index e769fd7b1b..e9d3b24d1b 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -128,9 +128,6 @@ function dispatch() tpl.viewns.media = luci.config.main.mediaurlbase tpl.viewns.resource = luci.config.main.resourcebase - -- Load default translation - require("luci.i18n").loadc("default") - if c and type(c.target) == "function" then dispatched = c @@ -224,10 +221,20 @@ function createtree() end require("luci.i18n") + + -- Load default translation + luci.i18n.loadc("default") + + local scope = _G + for k,v in pairs(_M) do + if type(v) == "function" then + scope[k] = v + end + end for k, v in pairs(index) do - luci.util.updfenv(v, _M) - luci.util.extfenv(v, "_NAME", k) + scope._NAME = k + setfenv(v, scope) local stat, err = pcall(v) if not stat then diff --git a/libs/web/root/etc/config/luci b/libs/web/root/etc/config/luci index 701c939386..5fefe5b273 100644 --- a/libs/web/root/etc/config/luci +++ b/libs/web/root/etc/config/luci @@ -1,33 +1,33 @@ config core main option lang de - option mediaurlbase /luci-static/fledermaus + option mediaurlbase /luci-static/openwrt.org option resourcebase /luci-static/resources config core brand - option title "OpenWRT Kamikaze" - option subtitle Freifunkedition - option firmware "OpenWRT Kamikaze" - option distro "Freifunk Firmware 2.x" + option title "OpenWRT Kamikaze" + option subtitle "Lua Configuration Interface" + option firmware "OpenWRT Kamikaze" + option distro "Development Snapshot" config extern flash_keep - option uci "/etc/config" + option uci "/etc/config" option dropbear "/etc/dropbear" option openvpn "/etc/openvpn" option passwd "/etc/passwd" - option ipkg "/etc/ipkg.conf" + option ipkg "/etc/ipkg.conf" option httpd "/etc/httpd.conf" option firewall "/etc/firewall.user" config event uci_oncommit option network "/etc/init.d/network restart" option wireless "/etc/init.d/network restart" - option olsr "/sbin/reboot" - option dhcp "/etc/init.d/dnsmasq restart" + option olsr "/etc/init.d/olsrd restart" + option dhcp "/etc/init.d/dnsmasq restart" option luci_fw "/etc/init.d/luci_fw restart" option dropbear "/etc/init.d/dropbear restart" option httpd "/etc/init.d/httpd restart" option fstab "/etc/init.d/fstab restart" - option qos "/etc/init.d/qos restart" + option qos "/etc/init.d/qos restart" option luci_splash "/etc/init.d/luci_splash restart" option freifunk "/etc/init.d/luci_freifunk restart" @@ -36,4 +36,5 @@ config internal languages option en "English" config internal themes + option OpenWRT "/luci-static/openwrt.org" option Fledermaus "/luci-static/fledermaus" diff --git a/modules/admin-core/luasrc/controller/admin/index.lua b/modules/admin-core/luasrc/controller/admin/index.lua index 7ce7f1bdc5..51f60bd83c 100644 --- a/modules/admin-core/luasrc/controller/admin/index.lua +++ b/modules/admin-core/luasrc/controller/admin/index.lua @@ -1,26 +1,30 @@ module("luci.controller.admin.index", package.seeall) function index() + luci.i18n.loadc("admin-core") + local i18n = luci.i18n.translate + local root = node() if not root.target then root.target = alias("admin") end - entry({"about"}, template("about")) + entry({"about"}, template("about")).i18n = "admin-core" local page = node("admin") page.target = alias("admin", "index") - page.title = "Administration" + page.title = i18n("administration", "Administration") page.order = 10 + page.i18n = "admin-core" local page = node("admin", "index") page.target = template("admin_index/index") - page.title = "Übersicht" + page.title = i18n("overview", "Übersicht") page.order = 10 local page = node("admin", "index", "luci") page.target = cbi("admin_index/luci") - page.title = "Oberfläche" + page.title = i18n("a_i_ui", "Oberfläche") end \ No newline at end of file diff --git a/modules/admin-core/luasrc/controller/admin/status.lua b/modules/admin-core/luasrc/controller/admin/status.lua index 79f728b99d..223f54b295 100644 --- a/modules/admin-core/luasrc/controller/admin/status.lua +++ b/modules/admin-core/luasrc/controller/admin/status.lua @@ -1,8 +1,11 @@ module("luci.controller.admin.status", package.seeall) function index() - entry({"admin", "status"}, template("admin_status/index"), "Status", 20) - entry({"admin", "status", "syslog"}, call("action_syslog"), "Systemprotokoll") + luci.i18n.loadc("admin-core") + local i18n = luci.i18n.translate + + entry({"admin", "status"}, template("admin_status/index"), i18n("status", "Status"), 20) + entry({"admin", "status", "syslog"}, call("action_syslog"), i18n("syslog", "Systemprotokoll")) end function action_syslog() diff --git a/modules/admin-core/luasrc/controller/admin/system.lua b/modules/admin-core/luasrc/controller/admin/system.lua index a7c65872af..1bd52e943d 100644 --- a/modules/admin-core/luasrc/controller/admin/system.lua +++ b/modules/admin-core/luasrc/controller/admin/system.lua @@ -8,14 +8,17 @@ require("luci.model.ipkg") require("luci.model.uci") function index() - entry({"admin", "system"}, template("admin_system/index"), "System", 30) - entry({"admin", "system", "packages"}, call("action_packages"), "Paketverwaltung", 10) - entry({"admin", "system", "packages", "ipkg"}, call("action_ipkg"), "IPKG-Konfiguration") - entry({"admin", "system", "passwd"}, call("action_passwd"), "Passwort ändern", 20) - entry({"admin", "system", "sshkeys"}, call("action_sshkeys"), "SSH-Schlüssel", 30) - entry({"admin", "system", "hostname"}, cbi("admin_system/hostname"), "Hostname", 40) - entry({"admin", "system", "fstab"}, cbi("admin_system/fstab"), "Einhängepunkte", 50) - entry({"admin", "system", "upgrade"}, call("action_upgrade"), "Firmwareupgrade", 60) + luci.i18n.loadc("admin-core") + local i18n = luci.i18n.translate + + entry({"admin", "system"}, template("admin_system/index"), i18n("system", "System"), 30) + entry({"admin", "system", "packages"}, call("action_packages"), i18n("a_s_packages", "Paketverwaltung"), 10) + entry({"admin", "system", "packages", "ipkg"}, call("action_ipkg"), i18n("a_s_ipkg", "IPKG-Konfiguration")) + entry({"admin", "system", "passwd"}, call("action_passwd"), i18n("a_s_changepw", "Passwort ändern"), 20) + entry({"admin", "system", "sshkeys"}, call("action_sshkeys"), i18n("a_s_sshkeys", "SSH-Schlüssel"), 30) + entry({"admin", "system", "hostname"}, cbi("admin_system/hostname"), i18n("hostname", "Hostname"), 40) + entry({"admin", "system", "fstab"}, cbi("admin_system/fstab"), i18n("a_s_fstab", "Einhängepunkte"), 50) + entry({"admin", "system", "upgrade"}, call("action_upgrade"), i18n("fwupgrade", "Firmwareupgrade"), 60) entry({"admin", "system", "reboot"}, call("action_reboot"), "Neu starten", 70) end diff --git a/modules/admin-core/luasrc/i18n/admin_index.en b/modules/admin-core/luasrc/i18n/admin_index.en deleted file mode 100644 index 0831b59f01..0000000000 --- a/modules/admin-core/luasrc/i18n/admin_index.en +++ /dev/null @@ -1,20 +0,0 @@ -luci = "User Interface" - -hello = "Hello!" -admin1 = "This is the administration area of LuCI." -admin2 = "LuCI is a free, flexible, and user friendly graphical interface for configuring OpenWRT Kamikaze." -admin3 = "On the following pages you can adjust all important settings of your router." -admin4 = "You will find a navigation leading to the different configuration pages on the left side." -admin5 = [[As we are always want to improve this interface we are looking forward -to your feedback and suggestions.]] -admin6 = "And now have fun with your router!" -team = "The LuCI Team" - -luci1 = "Here you can customize the settings and the functionality of LuCI." -language = "Language" -general = "General" -ucicommit = "Post-commit actions" -ucicommit1 = [[These commands will be executed automatically when a given UCI configuration is committed allowing -changes to be applied instantly.]] -keepflash = "Files to be kept when flashing a new firmware" -keepflash1 = "When flashing a new firmware with LuCI these files will be added to the new firmware installation." \ No newline at end of file diff --git a/modules/admin-core/luasrc/view/about.htm b/modules/admin-core/luasrc/view/about.htm index 48a8674e00..c6dd1a1015 100644 --- a/modules/admin-core/luasrc/view/about.htm +++ b/modules/admin-core/luasrc/view/about.htm @@ -1,25 +1,25 @@ <%+header%> -

<%:about Über%> Luci

-

<%:lucidesc Luci ist eine freie Lua-Bibliothek mit integriertem MVC-Webframework und Weboberfläche für eingebettete Geräte, +

<%:about Über%> LuCI

+

<%:c_lucidesc LuCI ist eine freie Lua-Bibliothek mit integriertem MVC-Webframework und Weboberfläche für eingebettete Geräte, speziell Netzwerkrouter unter OpenWRT. Luci steht unter der Apache-Lizenz.%>

-

<%:projecthome Projekt-Homepage%>: luci.freifunk-halle.net

+

<%:c_projecthome Projekt-Homepage%>: luci.freifunk-halle.net


-

<%:leaddev Leitende Entwicklung%>

+

<%:c_leaddev Leitende Entwicklung%>


-

<%:contributors Mitwirkende Entwickler%>

+

<%:c_contributors Mitwirkende Entwickler%>


-

<%:thanksto Dank an%>

+

<%:c_thanksto Dank an%>