add multi-language support to webif (currently supported: english, german)
authorFelix Fietkau <nbd@openwrt.org>
Sun, 5 Feb 2006 17:43:26 +0000 (17:43 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 5 Feb 2006 17:43:26 +0000 (17:43 +0000)
SVN-Revision: 3140

27 files changed:
openwrt/package/webif/Makefile
openwrt/package/webif/files/usr/lib/webif/apply.sh
openwrt/package/webif/files/usr/lib/webif/categories.awk
openwrt/package/webif/files/usr/lib/webif/common.awk
openwrt/package/webif/files/usr/lib/webif/form.awk
openwrt/package/webif/files/usr/lib/webif/lang/de/common.txt [new file with mode: 0644]
openwrt/package/webif/files/usr/lib/webif/subcategories.awk
openwrt/package/webif/files/usr/lib/webif/validate.awk
openwrt/package/webif/files/usr/lib/webif/webif.sh
openwrt/package/webif/files/www/cgi-bin/webif/about.sh
openwrt/package/webif/files/www/cgi-bin/webif/config.sh
openwrt/package/webif/files/www/cgi-bin/webif/connection.sh
openwrt/package/webif/files/www/cgi-bin/webif/hosts.sh
openwrt/package/webif/files/www/cgi-bin/webif/index.sh
openwrt/package/webif/files/www/cgi-bin/webif/info.sh
openwrt/package/webif/files/www/cgi-bin/webif/ipkg.sh
openwrt/package/webif/files/www/cgi-bin/webif/lan.sh
openwrt/package/webif/files/www/cgi-bin/webif/leases.sh
openwrt/package/webif/files/www/cgi-bin/webif/password.sh
openwrt/package/webif/files/www/cgi-bin/webif/system.sh
openwrt/package/webif/files/www/cgi-bin/webif/upgrade.sh
openwrt/package/webif/files/www/cgi-bin/webif/wan.sh
openwrt/package/webif/files/www/cgi-bin/webif/wireless-advanced.sh
openwrt/package/webif/files/www/cgi-bin/webif/wireless-config.sh
openwrt/package/webif/files/www/cgi-bin/webif/wireless-status.sh
openwrt/package/webif/files/www/webif.js
openwrt/package/webif/src/webif-page.c [new file with mode: 0644]

index 4fe756d1141fa4b0577639aa3bfd5766732b734f..cc6c26ac77e9afbfd214f869e405daf3c68f3700 100644 (file)
@@ -8,6 +8,9 @@ PKG_RELEASE:=1
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 
+# for whiterussian only:
+NVRAM_OPTS=-DNVRAM -lnvram -I$(STAGING_DIR)/usr/include -L$(STAGING_DIR)/usr/lib
+
 include $(TOPDIR)/package/rules.mk
 
 $(eval $(call PKG_template,WEBIF,webif,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
@@ -20,10 +23,14 @@ $(PKG_BUILD_DIR)/.configured:
        touch $@
 
 $(PKG_BUILD_DIR)/.built:
+       $(TARGET_CC) $(TARGET_CFLAGS) $(NVRAM_OPTS) -o $(PKG_BUILD_DIR)/webif-page src/webif-page.c
+       $(STRIP) $(PKG_BUILD_DIR)/webif-page
        touch $@
 
 $(IPKG_WEBIF): 
        cp -a ./files/* $(IDIR_WEBIF)/
+       install -d $(IDIR_WEBIF)/usr/bin
+       install -m0755 $(PKG_BUILD_DIR)/webif-page $(IDIR_WEBIF)/usr/bin/webif-page
        find $(IDIR_WEBIF) -name CVS | xargs rm -rf
        find $(IDIR_WEBIF) -name .svn | xargs rm -rf
        $(IPKG_BUILD) $(IDIR_WEBIF) $(PACKAGE_DIR)
index 8cafa4fa92e3f7ac859081cc9dd9d722651efd25..1a908cd77e0c999161eb2fb7c5c3d24588fc6939 100644 (file)
@@ -16,7 +16,7 @@ HANDLERS_file='
 eval "$(cat /usr/lib/webif/apply-*.sh 2>&-)"
 
 reload_network() {
-       echo Reloading networking settings ...
+       echo '@TR<<Reloading>> @TR<<networking settings>> ...'
        grep '^wan_' config-network >&- 2>&- && {
                ifdown wan
                ifup wan
@@ -31,14 +31,14 @@ reload_network() {
 }
 
 reload_wireless() {
-       echo Reloading wireless settings ...
+       echo '@TR<<Reloading>> @TR<<wireless settings>> ...'
        killall nas >&- 2>&- && sleep 2
        /sbin/wifi
        [ -f /etc/init.d/S41wpa ] && /etc/init.d/S41wpa
 }
 
 reload_system() {
-       echo Applying system settings ...
+       echo '@TR<<Applying>> @TR<<system settings>> ...'
        echo "$(nvram get wan_hostname)" > /proc/sys/kernel/hostname
 }
 
@@ -47,7 +47,7 @@ cd /tmp/.webif
 # file-*               other config files
 for config in $(ls file-* 2>&-); do
        name=${config#file-}
-       echo "Processing config file: $name"
+       echo "@TR<<Processing>> @TR<<config file>>: $name"
        eval 'case "$name" in
                '"$HANDLERS_file"'
        esac'
@@ -58,7 +58,7 @@ done
        cd /proc/self
        cat /tmp/.webif/config-* 2>&- | grep '=' >&- 2>&- && {
                cat /tmp/.webif/config-* 2>&- | tee fd/1 | xargs -n1 nvram set
-               echo "Committing NVRAM ..."
+               echo "@TR<<Committing>> NVRAM ..."
                nvram commit
        }
 )
index 26dcf39c5b1b3e1883bcf711c3397fcd63b5ac85..00312c93da7da7750261fd8ccf7cf1338535de13 100644 (file)
@@ -12,15 +12,15 @@ BEGIN {
 }
 ($3 == "name") && ((p[$4] == 0) || (p[$4] > int($5))) {
        gsub(/^.*\//, "", $1);
-       p[$4] = int($5)
+       p[$4] = int($5) + 1
        f[$4] = rootdir "/" $1
 }
 END {
-       print "<div id=\"mainmenu\"><h3><strong>Categories:</strong></h3><ul>"
+       print "<div id=\"mainmenu\"><h3><strong>@TR<<Categories>>:</strong></h3><ul>"
        
        for (i = 1; i <= n; i++) {
-               if (sel == i) print "<li class=\"selected-maincat\"><a href=\"" f[c[i]] "\">&raquo;" c[i] "&laquo;</a></li>"
-               else print "<li><a href=\"" f[c[i]] "\">&nbsp;" c[i] "&nbsp;</a></li>";
+               if (sel == i) print "<li class=\"selected-maincat\"><a href=\"" f[c[i]] "\">&raquo;@TR<<" c[i] ">>&laquo;</a></li>"
+               else print "<li><a href=\"" f[c[i]] "\">&nbsp;@TR<<" c[i] ">>&nbsp;</a></li>";
        }
   
        print "</ul></div>"
index c6f180b729c6ece5bf782c6172e350379ce54460..f8f44207d3e6253005d9a91e08a594096b56afa0 100644 (file)
@@ -7,6 +7,6 @@ function start_form(title, field_opts) {
 function end_form(form_help, form_help_link) {
        print "</div>"
        if (form_help != "") form_help = "<dl>" form_help "</dl>"
-       print "<div class=\"settings-help\"><blockquote><h3><strong>Short help:</strong></h3>" form_help form_help_link "</blockquote></div>"
+       print "<div class=\"settings-help\"><blockquote><h3><strong>@TR<<Short help>>:</strong></h3>" form_help form_help_link "</blockquote></div>"
        print "<div style=\"clear: both\">&nbsp;</div></div>"
 }
index 5c5cf52c83b4468a19f0abe1fb0358ba22f73c35..a35a48a31ddccad9595c798a522e94a72752bbfc 100644 (file)
@@ -58,6 +58,7 @@ $1 ~ /^select/ {
        opts = ""
        if (onchange != "") opts = opts " onClick=\"" onchange "()\" onChange=\"" onchange "()\""
        print "<select id=\"" $2 "\" name=\"" $2 "\"" opts ">"
+       select_id = $2
        select_open = 1
        select_default = $3
 }
@@ -66,23 +67,23 @@ $1 ~ /^select/ {
        else option_selected=""
        if ($3 != "") option_title = $3
        else option_title = $2
-       print "<option" option_selected " value=\"" $2 "\">" option_title "&nbsp;&nbsp;</option>"
+       print "<option id=\"" select_id "_" $2 "\"" option_selected " value=\"" $2 "\">" option_title "&nbsp;&nbsp;</option>"
 }
 ($1 ~ /^listedit/) {
        n = split($4 " ", items, " ")
        for (i = 1; i <= n; i++) {
-               if (items[i] != "") print "<tr><td width=\"50%\">" items[i] "</td><td>&nbsp;<a href=\"" $3 $2 "remove=" items[i] "\">Remove</a></td></tr>"
+               if (items[i] != "") print "<tr><td width=\"50%\">" items[i] "</td><td>&nbsp;<a href=\"" $3 $2 "remove=" items[i] "\">@TR<<Remove>></a></td></tr>"
        }
-       print "<tr><td width=\"100%\" colspan="2"><input type=\"text\" name=\"" $2 "add\" value=\"" $5 "\" /><input type=\"submit\" name=\"" $2 "submit\" value=\"Add\" /></td></tr>"
+       print "<tr><td width=\"100%\" colspan="2"><input type=\"text\" name=\"" $2 "add\" value=\"" $5 "\" /><input type=\"submit\" name=\"" $2 "submit\" value=\"@TR<<Add>>\" /></td></tr>"
 }
 $1 ~ /^caption/ { print "<b>" $2 "</b>" }
 $1 ~ /^string/ { print $2 }
 $1 ~ /^text/ { print "<input id=\"" $2 "\" type=\"text\" name=\"" $2 "\" value=\"" $3 "\" />" $4 }
 $1 ~ /^password/ { print "<input id=\"" $2 "\" type=\"password\" name=\"" $2 "\" value=\"" $3 "\" />" $4 }
 $1 ~ /^submit/ { print "<input type=\"submit\" name=\"" $2 "\" value=\"" $3 "\" />" }
-$1 ~ /^helpitem/ { form_help = form_help "<dt>" $2 ":</dt>" }
-$1 ~ /^helptext/ { form_help = form_help "<dd>" $2 "</dd>" }
-$1 ~ /^helplink/ { form_help_link = "<div class=\"more-help\"><a href=\"" $2 "\">more...</a></div>" }
+$1 ~ /^helpitem/ { form_help = form_help "<dt>" $2 ": </dt>" }
+$1 ~ /^helptext/ { form_help = form_help "<dd>" $2 " </dd>" }
+$1 ~ /^helplink/ { form_help_link = "<div class=\"more-help\"><a href=\"" $2 "\">@TR<<more...>></a></div>" }
 
 ($1 ~ /^checkbox/) || ($1 ~ /^radio/) {
        print $5
diff --git a/openwrt/package/webif/files/usr/lib/webif/lang/de/common.txt b/openwrt/package/webif/files/usr/lib/webif/lang/de/common.txt
new file mode 100644 (file)
index 0000000..e88028c
--- /dev/null
@@ -0,0 +1,188 @@
+# Common
+Settings saved => Einstellungen gespeichert
+Settings not saved => Einstellungen nicht gespeichert
+Save Changes => Speichern
+Apply Changes => Übernehmen
+Clear Changes => Verwerfen
+Review Changes => Anzeigen
+Host Name => Hostname
+Uptime => Uptime
+Load => Systemlast
+Version => Version
+Categories => Kategorien
+Subcategories => Unterkategorien
+more... => mehr...
+Add => Hinzufügen
+Remove => Entfernen
+
+# Categories
+Info => Info
+About => Über
+Router Info => Routerinformationen
+
+Status => Status
+Connections => Netzwerkverbindungen
+DHCP => DHCP
+Wireless => WLAN
+
+System => System
+Password => Passwort
+Settings => Einstellungen
+Installed Software => Installierte Software
+Firmware Upgrade => Firmware aktualisieren
+
+Network => Netzwerk
+LAN => LAN
+WAN => Internet
+Wireless => WLAN
+Advanced Wireless => WLAN (erweitert)
+Hosts => Host-Konfiguration
+
+
+# 'About' page
+Copyright => Copyright
+
+GPL_Text => Dieses Programm ist freie Software. Sie können es unter den Bedingungen der GNU General Public License,<br /> wie von der Free Software Foundation veröffentlicht, weitergeben und/oder modifizieren,<br /> entweder gemäß Version 2 der Lizenz oder (nach Ihrer Option) jeder späteren Version.
+Contributions by => Mit Beiträgen von
+Layout based on => Layout basiert auf
+by => von
+
+
+No config change. => Es wurden keine Konfigurationsänderungen vorgenommen.
+Config discarded. => Ihre Konfigurationsänderungen wurden verworfen.
+Config changes: => Aktuelle Konfigurationsänderungen:
+Updating config... => Aktualisiere die Konfiguration...
+
+
+# 'Router Info' page
+Firmware Version => Firmwareversion
+Kernel Version => Kernelversion
+Current Date/Time => Datum/Uhrzeit
+MAC Address => MAC-Adresse
+
+
+# 'Connections' page
+Connection Status => Verbindungsstatus
+Physical Connections => Netzwerkschnittstellen
+Router Connections => Netzwerkverbindungen auf dem Router
+
+
+# 'DHCP' page
+DHCP leases => DHCP-Leases
+IP Address => IP-Adresse
+Name => Name
+Expires in => Gültigkeitsdauer
+
+
+# 'Wireless Status' page
+Wireless Status => WLAN-Status
+
+# 'Password' page
+Password Change => Passwortänderung
+New Password => Neues Passwort
+Confirm Password => Passwort bestätigen
+
+# 'System Settings' page
+System Settings => Systemeinstellungen
+Host Name => Hostname
+
+
+# 'Installed Software' page
+Installed Packages => Installierte Pakete
+Update package lists => Paketlisten aktualisieren
+Uninstall => Deinstallieren
+Install => Installieren
+
+
+# 'Firmware Upgrade' page
+Firmware format => Firmware-Format
+converting... => konvertiere...
+Error => Fehler
+done => fertig
+Invalid_format => Das Dateiformat der Firmware ist ungültig
+Open_failed => Konnte die Firmwaredatei nicht öffnen
+Erase_JFFS2 => JFFS2-Partition löschen
+Erase NVRAM => NVRAM löschen
+Options => Optionen
+Firmware_image => Firmware-Datei:
+Upgrade => Aktualisieren
+Upgrading... => Aktualisiere...
+
+# 'LAN Settings' page
+LAN Settings => Netzwerkeinstellungen
+LAN Configuration => Netzwerkkonfiguration
+Netmask => Subnetzmaske
+Default Gateway => Standardgateway
+DNS Servers => DNS-Server
+DNS Address => DNS-Serveradresse
+
+Note => Hinweis
+Helptext DNS save => Sie müssen Ihre Änderungen an dieser Seite speichern, bevor Sie DNS-Server hinzufügen oder entfernen
+
+
+# 'WAN Settings' page
+WAN Settings => Internet-Einstellungen
+WAN Configuration => Internet-Konfiguration
+PPTP Server IP => PPTP-Serveradresse
+Connection Type => Verbindungsart
+No WAN => Keine Verbindung
+DHCP => DHCP
+Static IP => Statische Konfiguration
+IP Settings => IP-Konfiguration
+PPP Settings => PPP-Einstellungen
+Redial Policy => Verbindungsaufbau
+Connect on Demand => Bei Bedarf
+Keep Alive => Verbindung aufrechterhalten
+Maximum Idle Time => Maximale Wartezeit bei Inaktivität
+Redial Timeout => Wartezeit bei unterbrochener Verbindung
+MTU => Maximale Paketgröße
+Username => Benutzername
+
+
+# 'Wireless Configuration' page
+Wireless Configuration => WLAN-Konfiguration
+Wireless Interface => WLAN-Interface
+WEP Key => WEP-Schlüssel
+Selected WEP Key => Ausgewählter WEP Schlüssel
+WPA PSK => WPA-Schlüssel
+ESSID => ESSID
+Channel => Kanal
+RADIUS IP Address => RADIUS-Serveradresse
+RADIUS Server Key => RADIUS-Serverpasswort
+Enabled => Aktiviert
+Disabled => Deaktiviert
+ESSID Broadcast => ESSID-Broadcast 
+Show => Anzeigen
+Hide => Verstecken
+WLAN Mode => Betriebsmodus
+Access Point => Access Point
+Client => Client
+Bridge => Bridge
+Ad-Hoc => Ad-Hoc
+Operation mode => Betriebsmodus des Funknetzwerks
+Encryption Settings => Verschlüsselungseinstellungen
+Encryption Type => Verschlüsselungsart
+PSK => Passwort
+WPA Mode => WPA-Modus
+WPA Algorithms => WPA-Verschlüsselungsalgorithmen
+WEP Keys => WEP-Schlüssel
+
+Helptext ESSID => Name des Funknetzwerks
+
+# 'Advanced Wireless Configuration' page
+Advanced Wireless Configuration => WLAN-Konfiguration (erweitert)
+WDS Connections => WDS-Verbindungen
+MAC Filter List => Zugriffsbeschränkung (MAC-Adresse)
+Filter Mode => Filtermodus
+Allow => Erlauben
+Deny => Verweigern
+Set => Setzen
+Settings => Einstellungen
+Automatic WDS => Automatische WDS-Verbindung
+
+# "Hosts" page
+
+MAC Address => MAC-Adresse
+Configured Hosts => Konfigurierte Hosts
+DHCP Static => Statische DHCP-Einträge
+Host Names => Host-Einträge
index b748de2cb46ce0178c519f89e63ee1470af13de9..8891ce44db50d2e2d6ba9e10f4817a728829a583 100644 (file)
@@ -1,10 +1,10 @@
 BEGIN {
        FS=":"
-       print "<div id=\"submenu\"><h3><strong>Sub-Categories:</strong></h3><ul>"
+       print "<div id=\"submenu\"><h3><strong>@TR<<Subcategories>>:</strong></h3><ul>"
 }
 {
-       if ($5 ~ "^" selected "$") print "<li class=\"selected-maincat\"><a href=\"" rootdir "/" $6 "\">&raquo;" $5 "&laquo;</a></li>"
-       else print "<li><a href=\"" rootdir "/" $6 "\">&nbsp;" $5 "&nbsp;</a></li>"
+       if ($5 ~ "^" selected "$") print "<li class=\"selected-maincat\"><a href=\"" rootdir "/" $6 "\">&raquo;@TR<<" $5 ">>&laquo;</a></li>"
+       else print "<li><a href=\"" rootdir "/" $6 "\">&nbsp;@TR<<" $5 ">>&nbsp;</a></li>"
 }
 END {
        print "</ul></div>"
index dfbe12028750150529b09c442818aab6d7954da4..20501a24e379d990af35bfcedfd92b017dc1ba2c 100644 (file)
@@ -20,7 +20,7 @@ BEGIN {
 
 $1 == "int" {
        valid_type = 1
-       if (value !~ /^[0-9]*$/) { valid = 0; verr = "Invalid value" }
+       if (value !~ /^[0-9]*$/) { valid = 0; verr = "@TR<<Invalid value>>" }
 }
 
 # FIXME: add proper netmask validation
@@ -33,14 +33,14 @@ $1 == "int" {
                        if ((ipaddr[i] < 0) || (ipaddr[i] > 255)) valid = 0
                }
        }
-       if (valid == 0) verr = "Invalid value"
+       if (valid == 0) verr = "@TR<<Invalid value>>"
 }
 
 $1 == "wep" {
        valid_type = 1
        if (value !~ /^[0-9A-Fa-f]*$/) {
                valid = 0
-               verr = "Invalid value"
+               verr = "@TR<<Invalid value>>"
        } else if ((length(value) != 0) && (length(value) != 10) && (length(value) != 26)) {
                valid = 0
                verr = "Invalid key length"
@@ -54,7 +54,7 @@ $1 == "hostname" {
        valid_type = 1
        if (value !~ /^[0-9a-zA-z\.\-]*$/) {
                valid = 0
-               verr = "Invalid value"
+               verr = "@TR<<Invalid value>>"
        }
 }
 
@@ -66,7 +66,7 @@ $1 == "mac" {
        valid_type = 1
        if ((value != "") && (value !~ /^[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]$/)) {
                valid = 0
-               verr = "Invalid value"
+               verr = "@TR<<Invalid value>>"
        }
 }
 
@@ -107,14 +107,14 @@ valid == 1 {
                        sub(/^max=/, "", max)
                        max = int(max)
                        if ($1 == "int") {
-                               if (value > max) { valid = 0; verr = "Value too large" }
+                               if (value > max) { valid = 0; verr = "@TR<<Value too large>> (@TR<<maximum>>: " max ")" }
                        } else if ($1 == "string") {
-                               if (length(value) > max) { valid = 0; verr = "Value too large" }
+                               if (length(value) > max) { valid = 0; verr = "@TR<<String too short>> (@TR<<maximum>>: " max ")" }
                        }
                } else if ((options[i] == "nodots") && ($1 == "hostname")) {
                        if (value ~ /\./) {
                                valid = 0
-                               verr = "Invalid value"
+                               verr = "@TR<<Invalid value>>"
                        }
                }
        }
index 619557fe4384d0962d5dc0167fe2056a009b8bc4..033e192768d12d820e9312544bcf1b1a5be236e9 100644 (file)
@@ -51,11 +51,11 @@ update_changes() {
 
 header() {
        empty "$ERROR" && {
-               _saved_title="${SAVED:+: Settings saved}"
+               _saved_title="${SAVED:+: @TR<<Settings saved>>}"
        } || {
                FORM_submit="";
                ERROR="<h3>$ERROR</h3><br /><br />"
-               _saved_title=": Settings not saved"
+               _saved_title=": @TR<<Settings not saved>>"
        }
 
        _category="$1"
@@ -68,7 +68,7 @@ header() {
        _version="${_version%% ---*}"
        _head="${3:+<div class=\"settings-block-title\"><h2>$3$_saved_title</h2></div>}"
        _form="${5:+<form enctype=\"multipart/form-data\" action=\"$5\" method=\"post\"><input type="hidden" name="submit" value="1" />}"
-       _savebutton="${5:+<p><input type=\"submit\" name=\"action\" value=\"Save changes\" /></p>}"
+       _savebutton="${5:+<p><input type=\"submit\" name=\"action\" value=\"@TR<<Save Changes>>\" /></p>}"
        _categories=$(categories $1)
        _subcategories=${2:+$(subcategories "$1" "$2")}
        
@@ -86,7 +86,7 @@ Pragma: no-cache
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
        <head>
-       <title>OpenWrt Administrative Console</title>
+       <title>@TR<<OpenWrt Administrative Console>></title>
                <link rel="stylesheet" type="text/css" href="/webif.css" />
        </head>
        <body $4><div id="container">
@@ -96,10 +96,10 @@ Pragma: no-cache
                                <div id="short-status">
                                        <h3><strong>Status:</strong></h3>
                                        <ul>
-                                               <li><strong>Hostname:</strong> $_hostname</li>
-                                               <li><strong>Uptime:</strong> $_uptime</li>
-                                               <li><strong>Load:</strong> $_loadavg</li>
-                                               <li><strong>Version:</strong> $_version</li>
+                                               <li><strong>@TR<<Host Name>>:</strong> $_hostname</li>
+                                               <li><strong>@TR<<Uptime>>:</strong> $_uptime</li>
+                                               <li><strong>@TR<<Load>>:</strong> $_loadavg</li>
+                                               <li><strong>@TR<<Version>>:</strong> $_version</li>
                                        </ul>
                                </div>
                        </div>
@@ -130,7 +130,7 @@ EOF
 <br />
 <br />
 <br />
-<h3>Warning: you haven't set a password for the Web interface and SSH access<br />
+<h3>TR{Warning}: you haven't set a password for the Web interface and SSH access<br />
 Please enter one now (the user name in your browser will be 'root').</h3>
 <br />
 <br />
@@ -176,9 +176,9 @@ footer() {
                        </div>
                        <div class="apply">
                                <div>
-                                       <a href="config.sh?mode=save&amp;cat=$_category&amp;prev=$SCRIPT_NAME">Apply changes &laquo;</a><br />
-                                       <a href="config.sh?mode=clear&amp;cat=$_category&amp;prev=$SCRIPT_NAME">Clear changes &laquo;</a><br />
-                                       <a href="config.sh?mode=review&amp;cat=$_category&amp;prev=$SCRIPT_NAME">Review changes $_changes &laquo;</a>
+                                       <a href="config.sh?mode=save&amp;cat=$_category&amp;prev=$SCRIPT_NAME">@TR<<Apply Changes>> &laquo;</a><br />
+                                       <a href="config.sh?mode=clear&amp;cat=$_category&amp;prev=$SCRIPT_NAME">@TR<<Clear Changes>> &laquo;</a><br />
+                                       <a href="config.sh?mode=review&amp;cat=$_category&amp;prev=$SCRIPT_NAME">@TR<<Review Changes>> $_changes &laquo;</a>
                                </div>
                        </div>
                </div>
@@ -286,3 +286,4 @@ is_bcm947xx() {
        read _systype < /proc/cpuinfo
        equal "${_systype##* }" "BCM947XX"
 }
+
index 6a0d664186e5d84aed3ca97184ba6e6000401a2f..abaf27b435791cc8a8191d53290ef248653c51dd 100755 (executable)
@@ -1,23 +1,20 @@
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
 <? 
 . /usr/lib/webif/webif.sh
-header "Info" "About" "About webif"
+header "Info" "About" "@TR<<About>>..."
 ?>
 
-<h3>webif - OpenWrt Administrative Console</h3>
+<h3>webif - @TR<<OpenWrt Administrative Console>></h3>
 <br />
-This program is free software; you can redistribute it and/or <br />
-modify it under the terms of the GNU General Public License <br />
-as published by the Free Software Foundation; either version 2 <br />
-of the License, or (at your option) any later version. <br />
+@TR<<GPL_Text|This program is free software; you can redistribute it and/or <br />modify it under the terms of the GNU General Public License <br />as published by the Free Software Foundation; either version 2 <br />of the License, or (at your option) any later version. <br /> >>
 <br />
-Copyright &copy; 2005 Felix Fietkau &lt;<a href="mailto:openwrt@nbd.name">openwrt@nbd.name</a>&gt;<br />
+@TR<<Copyright>> &copy; 2005 Felix Fietkau &lt;<a href="mailto:openwrt@nbd.name">openwrt@nbd.name</a>&gt;<br />
 <br />
-Contributions by:
+@TR<<Contributions by>>:
 <ul class="about">
        <li class="about">Philipp Kewisch &lt;<a href="mailto:openwrt@kewis.ch">openwrt@kewis.ch</a>&gt;</li>
        <li class="about">Spectra &lt;<a href="mailto:spectra@gmx.ch">spectra@gmx.ch</a>&gt;</li>
-       <li class="about">Layout based on <a href="http://www.openwebdesign.org/design/1773/prosimii/">&quot;Prosimii&quot;</a> by haran</li>
+       <li class="about">@TR<<Layout based on>> <a href="http://www.openwebdesign.org/design/1773/prosimii/">&quot;Prosimii&quot;</a> @TR<<by>> haran</li>
 </ul>
 
 
index 373508d09c85d7e55e4034e6da8b6ceb0843df4a..0259537aa4a7747e42082697e91e185cb28c3582 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
 <? 
 . /usr/lib/webif/webif.sh
 
@@ -8,15 +8,15 @@ case "$CHANGES" in
        ""|0)FORM_mode=nochange
 esac
 case "$FORM_mode" in 
-       nochange) header $FORM_cat . "Configuration: no changes were made.";;
+       nochange) header $FORM_cat . "@TR<<No config change.|No configuration changes were made.>>";;
        clear)
                rm -rf /tmp/.webif >&- 2>&- 
-               header $FORM_cat . "Configuration: cleared."
+               header $FORM_cat . "@TR<<Config discarded.|Your configuration changes have been discarded.>>"
                CHANGES=""
                echo "${FORM_prev:+<meta http-equiv=\"refresh\" content=\"2; URL=$FORM_prev\" />}"
                ;;
        review)
-               header $FORM_cat . "Configuration changes:"
+               header $FORM_cat . "@TR<<Config changes:|Current configuration changes:>>"
                cd /tmp/.webif
                for configname in config-*; do
                        grep = $configname >&- 2>&- && {
@@ -33,10 +33,10 @@ case "$FORM_mode" in
                echo $CONFIGFILES
                ;;
        save)
-               header $FORM_cat . "Configuration: updating..."
+               header $FORM_cat . "@TR<<Updating config...|Updating your configuration...>>"
                CHANGES=""
                echo "<pre>"
-               sh /usr/lib/webif/apply.sh
+               sh /usr/lib/webif/apply.sh 2>&1
                echo "</pre>${FORM_prev:+<meta http-equiv=\"refresh\" content=\"2; URL=$FORM_prev\" />}"
                ;;
 esac
index 79ce59e20e43799df6d1aad1bc7c9f36798d7edd..cab7ebd7c15fce296ddee0cf73b770e34f21440a 100755 (executable)
@@ -1,12 +1,12 @@
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
 <? 
 . /usr/lib/webif/webif.sh
-header "Status" "Connections" "Connection status"
+header "Status" "Connections" "@TR<<Connection Status>>"
 ?>
 <table style="width: 90%; text-align: left;" border="0" cellpadding="2" cellspacing="2" align="center">
 <tbody>
        <tr>
-               <th><b>Ethernet/Wireless physical connections</b></th>
+               <th><b>@TR<<Physical Connections|Ethernet/Wireless Physical Connections>></b></th>
        </tr>
        <tr>
                <td><pre><? cat /proc/net/arp ?></pre></td>
@@ -15,10 +15,10 @@ header "Status" "Connections" "Connection status"
        <tr><td><br /><br /></td></tr>
 
        <tr>
-               <th><b>Connections to the router</b></th>
+               <th><b>@TR<<Router Connections|Connections to the Router>></b></th>
        </tr>
        <tr>
-               <td><pre><? netstat -n 2>&- ?></pre></td>
+               <td><pre><? netstat -n 2>&- | awk '$0 ~ /^Active UNIX/ {ignore = 1}; ignore != 1 { print $0 }' ?></pre></td>
        </tr>
 </tbody>
 </table>
index fd268eb9d6d85bb77a6cfd965546217d87bf927a..0757b86d6cfdccc29be7fa2d32e89e387dacf27d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
 <? 
 . /usr/lib/webif/webif.sh
 
@@ -62,16 +62,16 @@ update_ethers() {
 empty "$FORM_add_host" || {
        # add a host to /etc/hosts
        validate <<EOF
-ip|FORM_host_ip|IP Address|required|$FORM_host_ip
-hostname|FORM_host_name|Hostname|required|$FORM_host_name
+ip|FORM_host_ip|@TR<<IP Address>>|required|$FORM_host_ip
+hostname|FORM_host_name|@TR<<Host Name>>|required|$FORM_host_name
 EOF
        equal "$?" 0 && update_hosts add "$FORM_host_ip" "$FORM_host_name"
 }
 empty "$FORM_add_dhcp" || {
        # add a host to /etc/ethers
        validate <<EOF
-mac|FORM_dhcp_mac|MAC Address|required|$FORM_dhcp_mac
-ip|FORM_dhcp_ip|IP|required|$FORM_dhcp_ip
+mac|FORM_dhcp_mac|@TR<<MAC Address>>|required|$FORM_dhcp_mac
+ip|FORM_dhcp_ip|@TR<<IP Address>>|required|$FORM_dhcp_ip
 EOF
        equal "$?" 0 && update_ethers add "$FORM_dhcp_mac" "$FORM_dhcp_ip"
 }
@@ -79,7 +79,7 @@ EOF
 empty "$FORM_remove_host" || update_hosts del "$FORM_remove_ip" "$FORM_remove_name"
 empty "$FORM_remove_dhcp" || update_ethers del "$FORM_remove_mac"
 
-header "Network" "Hosts" "Configured hosts" ''
+header "Network" "Hosts" "@TR<<Configured Hosts>>" ''
 
 # Hosts in /etc/hosts
 awk -v "url=$SCRIPT_NAME" \
@@ -87,9 +87,9 @@ awk -v "url=$SCRIPT_NAME" \
        -v "name=$FORM_host_name"  -f /usr/lib/webif/common.awk -f - $HOSTS_FILE <<EOF
 BEGIN {
        FS="[ \t]"
-       start_form("Hostnames")
+       start_form("@TR<<Host Names>>")
        print "<table width=\"70%\" summary=\"Settings\">"
-       print "<tr><th>IP</th><th>Hostname</th><th></th></tr>"
+       print "<tr><th>@TR<<IP Address>></th><th>@TR<<Host Name>></th><th></th></tr>"
        print "<tr><td colspan=\"3\"><hr class=\"separator\" /></td></tr>"
 }
 
@@ -103,7 +103,7 @@ BEGIN {
        for (i = 2; i <= n; i++) {
                if (names[i] != "") {
                        if (first != 1) output = output "<tr>"
-                       output = output "<td>" names[i] "</td><td align=\\"right\\" width=\\"10%\\"><a href=\\"" url "?remove_host=1&remove_ip=" $1 "&remove_name=" names[i] "\\">Remove</a></td></tr>"
+                       output = output "<td>" names[i] "</td><td align=\\"right\\" width=\\"10%\\"><a href=\\"" url "?remove_host=1&remove_ip=" $1 "&remove_name=" names[i] "\\">@TR<<Remove>></a></td></tr>"
                        first = 0
                        names_found++
                }
@@ -116,7 +116,7 @@ BEGIN {
 
 END {
        print "<form enctype=\\"multipart/form-data\\" method=\\"post\\">"
-       print "<tr><td><input type\\"text\\" name=\\"host_ip\\" value=\\"" ip "\\" /></td><td><input type=\\"text\\" name=\\"host_name\\" value=\\"" name "\\" /></td><td style=\\"width: 10em\\"><input type=\\"submit\\" name=\\"add_host\\" value=\\"Add\\" /></td></tr>"
+       print "<tr><td><input type\\"text\\" name=\\"host_ip\\" value=\\"" ip "\\" /></td><td><input type=\\"text\\" name=\\"host_name\\" value=\\"" name "\\" /></td><td style=\\"width: 10em\\"><input type=\\"submit\\" name=\\"add_host\\" value=\\"@TR<<Add>>\\" /></td></tr>"
        print "</form>"
        print "</table>"
        end_form()
@@ -131,19 +131,19 @@ awk -v "url=$SCRIPT_NAME" \
 BEGIN {
        FS="[ \\t]"
        print "<form enctype=\\"multipart/form-data\\" method=\\"post\\">"
-       start_form("Static IP addresses (for DHCP)")
+       start_form("@TR<<DHCP Static|Static IP addresses (for DHCP)>>")
        print "<table width=\\"70%\\" summary=\\"Settings\\">"
-       print "<tr><th>MAC address</th><th>IP</th><th></th></tr>"
+       print "<tr><th>@TR<<MAC Address>></th><th>@TR<<IP Address>></th><th></th></tr>"
 }
 
 # only for valid MAC addresses
 (\$1 ~ /^[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]$/) {
        gsub(/#.*$/, "");
-       print "<tr><td>" \$1 "</td><td>" \$2 "</td><td align=\\"right\\" width=\\"10%\\"><a href=\\"" url "?remove_dhcp=1&remove_mac=" \$1 "\\">Remove</a></td></tr>"
+       print "<tr><td>" \$1 "</td><td>" \$2 "</td><td align=\\"right\\" width=\\"10%\\"><a href=\\"" url "?remove_dhcp=1&remove_mac=" \$1 "\\">@TR<<Remove>></a></td></tr>"
 }
 
 END {
-       print "<tr><td><input type\\"text\\" name=\\"dhcp_mac\\" value=\\"" mac "\\" /></td><td><input type=\\"text\\" name=\\"dhcp_ip\\" value=\\"" ip "\\" /></td><td style=\\"width: 10em\\"><input type=\\"submit\\" name=\\"add_dhcp\\" value=\\"Add\\" /></td></tr>"
+       print "<tr><td><input type\\"text\\" name=\\"dhcp_mac\\" value=\\"" mac "\\" /></td><td><input type=\\"text\\" name=\\"dhcp_ip\\" value=\\"" ip "\\" /></td><td style=\\"width: 10em\\"><input type=\\"submit\\" name=\\"add_dhcp\\" value=\\"@TR<<Add>>\\" /></td></tr>"
        print "</table>"
        print "</form>"
        end_form();
index 3ab14d61dac369943eca0486c412ed70642d8840..466b34d20816114e29f832544d572a083b98b310 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
 <? 
 . /usr/lib/webif/webif.sh
 category=$FORM_cat
index b9ebc075b2be2dd4b6a3bec7716ec8eef83e667d..1eee7f68080ed73c7c92130656e9c8dfcc9f4877 100755 (executable)
@@ -1,7 +1,7 @@
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
 <? 
 . /usr/lib/webif/webif.sh
-header "Info" "Router Info" "Router Info"
+header "Info" "Router Info" "@TR<<Router Info>>"
 
 ?>
 <pre><?
@@ -18,19 +18,19 @@ cat <<EOF
 <table style="width: 90%; text-align: left;" border="0" cellpadding="2" cellspacing="2" align="center">
 <tbody>
        <tr>
-               <td>Firmware Version</td>
+               <td>@TR<<Firmware Version>></td>
                <td>$_version</td>
        </tr>
        <tr>
-               <td>Kernel Version</td>
+               <td>@TR<<Kernel Version>></td>
                <td>$_kversion</td>
        </tr>
        <tr>
-               <td>Current Date/Time</td>
+               <td>@TR<<Current Date/Time>></td>
                <td>$_date</td>
        </tr>
        <tr>
-               <td>MAC-Address</td>
+               <td>@TR<<MAC Address>></td>
                <td>$_mac</td>
        </tr>
 </tbody>
index 8f2e04d580d5897541cb04944846b0abd1c7bfa3..620b9424fff3d18ebb9a69db335617da346798bf 100755 (executable)
@@ -1,9 +1,9 @@
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
 <? 
 . /usr/lib/webif/webif.sh
-header "System" "Installed software" "Installed software"
+header "System" "Installed Software" "@TR<<Installed Software>>"
 ?>
-<p style="position: absolute; right: 1em; top: 10.5em"><a href="ipkg.sh?action=update">Update package lists</a></p>
+<p style="position: absolute; right: 1em; top: 10.5em"><a href="ipkg.sh?action=update">@TR<<Update package lists>></a></p>
 <pre><?
 if [ "$FORM_action" = "update" ]; then
        ipkg update
@@ -14,14 +14,14 @@ elif [ "$FORM_action" = "remove" ]; then
 fi
 ?></pre>
 <div class="half noBorderOnLeft">
-  <h3>Installed packages</h3>
+  <h3>@TR<<Installed Packages>></h3>
   <table style="width: 90%">
 <?
 ipkg list_installed | awk -F ' ' '
 $2 !~ /terminated/ {
        link=$1
        gsub(/\+/,"%2B",link)
-       print "<tr><td>" $1 "</td><td><a href=\"ipkg.sh?action=remove&pkg=" link "\">Remove</td></tr>"
+       print "<tr><td>" $1 "</td><td><a href=\"ipkg.sh?action=remove&pkg=" link "\">@TR<<Uninstall>></td></tr>"
 }
 '
 ?>
@@ -39,7 +39,7 @@ $1 ~ /status/ {
        if (current != $1) print "<tr><th>" $1 "</th><td></td></tr>"
        link=$3
        gsub(/\+/,"%2B",link)
-       print "<tr><td>" $3 "</td><td><a href=\"ipkg.sh?action=install&pkg=" link "\">Install</td></tr>"
+       print "<tr><td>" $3 "</td><td><a href=\"ipkg.sh?action=install&pkg=" link "\">@TR<<Install>></td></tr>"
        current=$1
 }
 '
@@ -51,5 +51,5 @@ $1 ~ /status/ {
          
 <? footer ?>
 <!--
-##WEBIF:name:System:2:Installed software
+##WEBIF:name:System:2:Installed Software
 -->
index b853a7b6ebfdc79c826b0ffb2b707f549aef0ece..3ac9a1545e5486f77715df6b6d8774591cf98a03 100755 (executable)
@@ -1,11 +1,11 @@
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
 <? 
 . /usr/lib/webif/webif.sh
 load_settings network
 
 FORM_dns="${lan_dns:-$(nvram get lan_dns)}"
 LISTVAL="$FORM_dns"
-handle_list "$FORM_dnsremove" "$FORM_dnsadd" "$FORM_dnssubmit" 'ip|FORM_dnsadd|LAN DNS address|required' && {
+handle_list "$FORM_dnsremove" "$FORM_dnsadd" "$FORM_dnssubmit" 'ip|FORM_dnsadd|@TR<<DNS Address>>|required' && {
        FORM_dns="$LISTVAL"
        save_setting network lan_dns "$FORM_dns"
 }
@@ -18,9 +18,9 @@ if empty "$FORM_submit"; then
 else 
        SAVED=1
        validate <<EOF
-ip|FORM_lan_ipaddr|LAN IP|required|$FORM_lan_ipaddr
-netmask|FORM_lan_netmask|LAN network mask|required|$FORM_lan_netmask
-ip|FORM_lan_gateway|LAN gateway||$FORM_lan_gateway
+ip|FORM_lan_ipaddr|@TR<<IP Address>>|required|$FORM_lan_ipaddr
+netmask|FORM_lan_netmask|@TR<<Netmask>>|required|$FORM_lan_netmask
+ip|FORM_lan_gateway|@TR<<Gateway>>||$FORM_lan_gateway
 EOF
        equal "$?" 0 && {
                save_setting network lan_ipaddr $FORM_lan_ipaddr
@@ -29,21 +29,21 @@ EOF
        }
 fi
 
-header "Network" "LAN" "LAN settings" '' "$SCRIPT_NAME"
+header "Network" "LAN" "@TR<<LAN Configuration>>" '' "$SCRIPT_NAME"
 
 display_form <<EOF
-start_form|LAN Configuration
-field|IP Address
+start_form|@TR<<LAN Configuration>>
+field|@TR<<IP Address>>
 text|lan_ipaddr|$FORM_lan_ipaddr
-field|Netmask
+field|@TR<<Netmask>>
 text|lan_netmask|$FORM_lan_netmask
-field|Default Gateway
+field|@TR<<Default Gateway>>
 text|lan_gateway|$FORM_lan_gateway
 end_form
-start_form|DNS Servers
+start_form|@TR<<DNS Servers>>
 listedit|dns|$SCRIPT_NAME?|$FORM_dns|$FORM_dnsadd
-helpitem|Note
-helptext|You should save your settings on this page before adding/removing DNS servers
+helpitem|@TR<<Note>>
+helptext|@TR<<Helptext DNS save#You need save your settings on this page before adding/removing DNS servers>>
 end_form
 EOF
 
index ddf506591fd693590cc90629b8c53c983b11ee70..48364f300dcd2c46fe90594a083a52783105033c 100755 (executable)
@@ -1,15 +1,15 @@
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
 <? 
 . /usr/lib/webif/webif.sh
-header "Status" "DHCP" "DHCP leases"
+header "Status" "DHCP" "@TR<<DHCP leases>>"
 ?>
 <table style="width: 90%; text-align: left;" border="0" cellpadding="2" cellspacing="2" align="center">
 <tbody>
        <tr>
-               <th>MAC Address</th>
-               <th>IP Address</th>
-               <th>Name</th>
-               <th>Expires in</th>
+               <th>@TR<<MAC Address>></th>
+               <th>@TR<<IP Address>></th>
+               <th>@TR<<Name>></th>
+               <th>@TR<<Expires in>></th>
        </tr>
 <? [ -e /tmp/dhcp.leases ] && awk -vdate="$(date +%s)" '
 $1 > 0 {
index d0b66eb34de5eedc3885af9f8dd108d04d8db647..73967a09564acaabc0429f5e9ba2f8da7ede435b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
 <? 
 . /usr/lib/webif/webif.sh
 
@@ -22,13 +22,13 @@ EOF
        }
 }
 
-header "System" "Password" "Password change" '' "$SCRIPT_NAME"
+header "System" "Password" "@TR<<Password Change>>" '' "$SCRIPT_NAME"
 
 display_form <<EOF
-start_form|System settings
-field|New Password:
+start_form|@TR<<Password Change>>
+field|@TR<<New Password>>:
 password|pw1
-field|Confirm Password:
+field|@TR<<Confirm Password>>:
 password|pw2
 end_form
 EOF
index ffddf19c70fa01fe4480d71d973761dbd5508022..a169a3b480fdfbccd62695171eec67eb7a2e9d25 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
 <? 
 . /usr/lib/webif/webif.sh
 load_settings system
@@ -26,15 +26,16 @@ EOF
        }
 fi
 
-header "System" "Settings" "System settings" '' "$SCRIPT_NAME"
+header "System" "Settings" "@TR<<System Settings>>" '' "$SCRIPT_NAME"
 
 is_bcm947xx && bootwait_form="field|boot_wait
-radio|boot_wait|$FORM_boot_wait|on|On<br />
-radio|boot_wait|$FORM_boot_wait|off|Off"
+select|boot_wait|$FORM_boot_wait
+option|on|@TR<<Enabled>>
+option|off|@TR<<Disabled>>"
 
 display_form <<EOF
-start_form|System settings
-field|Hostname
+start_form|@TR<<System Settings>>
+field|@TR<<Host Name>>
 text|hostname|$FORM_hostname
 $bootwait_form
 field
index 32b75e243b7937a9dbf3da54c81d8c8d89865d8d..0715daa4cac23661bd329808d06d13231c330d24 100755 (executable)
@@ -1,7 +1,7 @@
-#!/usr/bin/haserl -u
+#!/usr/bin/webif-page -u
 <? 
 . /usr/lib/webif/webif.sh
-header "System" "Firmware upgrade" "Firmware upgrade"
+header "System" "Firmware Upgrade" "@TR<<Firmware Upgrade>>"
 
 strip_cybertan() {
        (
@@ -17,24 +17,24 @@ empty "$FORM_submit" || empty "$FORM_firmware" || {
                grep BCM947 /proc/cpuinfo > /dev/null && {
                        case "$HEADER" in
                                48445230) # TRX
-                                       echo "Firmware is in TRX format<br />"
+                                       echo "@TR<<Firmware format>>: TRX<br />"
                                        mv $FORM_firmware /tmp/upgrade.bin
                                        UPGRADE=1
                                ;;
                                57353447|57353453|57353473) # WRT54G(S)
-                                       echo "Firmware is in Cybertan BIN format, converting... "
+                                       echo "@TR<<Firmware format>>: Cybertan BIN =&lt; @TR<<converting...>> "
                                        strip_cybertan
-                                       echo "done <br />"
+                                       echo "@TR<<done>>. <br />"
                                        UPGRADE=1
                                ;;
                                *)
                                        rm $FORM_firmware
-                                       ERROR="<h2>Error: Invalid firmware file format</h2>"
+                                       ERROR="<h2>@TR<<Error>>: @TR<<Invalid_format|Invalid firmware file format>></h2>"
                                ;;
                        esac
                }
        } || {
-               ERROR="<h2>Error: Couldn't open firmware file</h2>"
+               ERROR="<h2>@TR<<Error>>: @TR<<Open_failed|Couldn't open firmware file>></h2>"
        }
 }
 ?>
@@ -43,20 +43,20 @@ empty "$FORM_submit" || empty "$FORM_firmware" || {
        <table style="width: 90%; text-align: left;" border="0" cellpadding="2" cellspacing="2" align="center">
        <tbody>
                <tr>
-                       <td>Options:</td>
+                       <td>@TR<<Options>>:</td>
                        <td>
-                               <input type="checkbox" name="erase_fs" value="1" checked="checked" />Erase JFFS2 partition<br />
-                               <input type="checkbox" name="erase_nvram" value="1" />Erase NVRAM
+                               <input type="checkbox" name="erase_fs" value="1" checked="checked" />@TR<<Erase_JFFS2|Erase JFFS2 partition>><br />
+                               <input type="checkbox" name="erase_nvram" value="1" />@TR<<Erase NVRAM>>
                        </td>
                </tr>
                <tr>
-                       <td>Firmware image to upload:</td>
+                       <td>@TR<<Firmware_image|Firmware image to upload:>></td>
                        <td>
                                <input type="file" name="firmware" />
                        </td>
                </tr>
                        <td />
-                       <td><input type="submit" name="submit" value="Upgrade" /></td>
+                       <td><input type="submit" name="submit" value="@TR<<Upgrade>>" /></td>
                </tr>
        </tbody>
        </table>
@@ -66,14 +66,14 @@ empty "$FORM_submit" || empty "$FORM_firmware" || {
        ERASE="${FORM_erase_fs:+-e linux }"
        ERASE="$ERASE${FORM_erase_nvram:+-e nvram }"
        cp /bin/busybox /tmp/
-       echo -n 'Upgrading... '
+       echo -n '@TR<<Upgrading...>> '
        # FIXME: probably a race condition (with the reboot), but it seems to work
-       mtd -r $ERASE write /tmp/upgrade.bin linux 2>&- | awk 'END { print "done." }'
+       mtd -r $ERASE write /tmp/upgrade.bin linux 2>&- | awk 'END { print "@TR<<done>>." }'
        exit
 ?>
 <?fi?>
 
 <? footer ?>
 <!--
-##WEBIF:name:System:3:Firmware upgrade
+##WEBIF:name:System:3:Firmware Upgrade
 -->
index f506c2ddda088f7c1588ea8a573533e5fdd93213..5359b04b33f84383338de46e3dac1f4811b6cb4d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
 <? 
 . /usr/lib/webif/webif.sh
 
@@ -6,7 +6,7 @@ load_settings network
 
 FORM_dns="${wan_dns:-$(nvram get wan_dns)}"
 LISTVAL="$FORM_dns"
-handle_list "$FORM_dnsremove" "$FORM_dnsadd" "$FORM_dnssubmit" 'ip|FORM_dnsadd|WAN DNS address|required' && {
+handle_list "$FORM_dnsremove" "$FORM_dnsadd" "$FORM_dnssubmit" 'ip|FORM_dnsadd|@TR<<DNS Address>>|required' && {
        FORM_dns="$LISTVAL"
        save_setting network wan_dns "$FORM_dns"
 }
@@ -44,7 +44,7 @@ else
        SAVED=1
 
        empty "$FORM_wan_proto" && {
-               ERROR="No WAN protocol selected
+               ERROR="@TR<<No WAN Proto|No WAN protocol has been selected>>
                return 255
        }
 
@@ -59,10 +59,10 @@ else
        esac
 
 validate <<EOF
-ip|FORM_wan_ipaddr|IP address|$V_IP|$FORM_wan_ipaddr
-netmask|FORM_wan_netmask|network mask|$V_NM|$FORM_wan_netmask
-ip|FORM_wan_gateway|gateway address||$FORM_wan_gateway
-ip|FORM_pptp_server_ip|PPTP server IP|$V_PPTP|$FORM_pptp_server_ip
+ip|FORM_wan_ipaddr|@TR<<IP Address>>|$V_IP|$FORM_wan_ipaddr
+netmask|FORM_wan_netmask|@TR<<Netmask>>|$V_NM|$FORM_wan_netmask
+ip|FORM_wan_gateway|@TR<<Default Gateway>>||$FORM_wan_gateway
+ip|FORM_pptp_server_ip|@TR<<PPTP Server IP>>|$V_PPTP|$FORM_pptp_server_ip
 EOF
        equal "$?" 0 && {
                save_setting network wan_proto $FORM_wan_proto
@@ -126,7 +126,7 @@ text|pptp_server_ip|$FORM_pptp_server_ip"
 }
 
 
-header "Network" "WAN" "WAN settings" ' onLoad="modechange()" ' "$SCRIPT_NAME"
+header "Network" "WAN" "@TR<<WAN Configuration>>" ' onLoad="modechange()" ' "$SCRIPT_NAME"
 
 cat <<EOF
 <script type="text/javascript" src="/webif.js "></script>
@@ -162,44 +162,44 @@ EOF
 
 display_form <<EOF
 onchange|modechange
-start_form|WAN Configuration
-field|Internet Connection Type
-radio|wan_proto|$FORM_wan_proto|none|None<br />
-radio|wan_proto|$FORM_wan_proto|dhcp|DHCP<br />
-radio|wan_proto|$FORM_wan_proto|static|Static IP<br />
+start_form|@TR<<WAN Configuration>>
+field|@TR<<Connection Type>>
+radio|wan_proto|$FORM_wan_proto|none|@TR<<No WAN#None>><br />
+radio|wan_proto|$FORM_wan_proto|dhcp|@TR<<DHCP>><br />
+radio|wan_proto|$FORM_wan_proto|static|@TR<<Static IP>><br />
 $PPPOE_OPTION
 $PPTP_OPTION
 end_form
-
-start_form|IP Settings|ip_settings|hidden
-field|Internet IP Address|wan_ipaddr|hidden
+tatus
+start_form|@TR<<IP Settings>>|ip_settings|hidden
+field|@TR<<IP Address>>|wan_ipaddr|hidden
 text|wan_ipaddr|$FORM_wan_ipaddr
-field|Subnet Mask|wan_netmask|hidden
+field|@TR<<Netmask>>|wan_netmask|hidden
 text|wan_netmask|$FORM_wan_netmask
-field|Gateway|wan_gateway|hidden
+field|@TR<<Default Gateway>>|wan_gateway|hidden
 text|wan_gateway|$FORM_wan_gateway
 $PPTP_SERVER_OPTION
 end_form
 
-start_form|DNS Servers|wan_dns|hidden
+start_form|@TR<<DNS Servers>>|wan_dns|hidden
 listedit|dns|$SCRIPT_NAME?wan_proto=static&|$FORM_dns|$FORM_dnsadd
-helpitem|Note
-helptext|You should save your settings on this page before adding/removing DNS servers
+helpitem|@TR<<Note>>
+helptext|@TR<<Helptext DNS save#You should save your settings on this page before adding/removing DNS servers>> 
 end_form
 
-start_form|PPP Settings|ppp_settings|hidden
-field|PPP Redial Policy|ppp_redial|hidden
-radio|ppp_redial|$FORM_ppp_redial|demand|Connect on Demand<br />
-radio|ppp_redial|$FORM_ppp_redial|persist|Keep Alive
-field|Maximum Idle Time|ppp_demand_idletime|hidden
+start_form|@TR<<PPP Settings>>|ppp_settings|hidden
+field|@TR<<Redial Policy>>|ppp_redial|hidden
+radio|ppp_redial|$FORM_ppp_redial|demand|@TR<<Connect on Demand>><br />
+radio|ppp_redial|$FORM_ppp_redial|persist|@TR<<Keep Alive>>
+field|@TR<<Maximum Idle Time>>|ppp_demand_idletime|hidden
 text|ppp_idletime|$FORM_ppp_idletime
-field|Redial Timeout|ppp_persist_redialperiod|hidden
+field|@TR<<Redial Timeout>>|ppp_persist_redialperiod|hidden
 text|ppp_redialperiod|$FORM_ppp_redialperiod
-field|PPP Username|ppp_username|hidden
+field|@TR<<Username>>|ppp_username|hidden
 text|ppp_username|$FORM_ppp_username
-field|PPP Password|ppp_passwd|hidden
-text|ppp_passwd|$FORM_ppp_passwd
-field|PPP MTU|ppp_mtu|hidden
+field|@TR<<Password>>|ppp_passwd|hidden
+password|ppp_passwd|$FORM_ppp_passwd
+field|@TR<<MTU>>|ppp_mtu|hidden
 text|ppp_mtu|$FORM_ppp_mtu
 end_form
 EOF
index 1157bf460b65c4be1ef272d554fbfcd5c62d8353..f8e4a3613dd8691de45872bf0189ad7e0405473b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
 <? 
 . /usr/lib/webif/webif.sh
 load_settings "wireless"
@@ -19,17 +19,12 @@ handle_list "$FORM_maclistremove" "$FORM_maclistadd" "$FORM_maclistsubmit" 'mac|
 }
 FORM_maclistadd=${FORM_maclistadd:-00:00:00:00:00:00}
 
-if empty "$FORM_macmode_set"; then
-       FORM_macmode="${wl0_macmode:-$(nvram get wl0_macmode)}"
-else
-       save_setting wireless wl0_macmode "$FORM_macmode"
-fi
-
 if empty "$FORM_submit"; then
+       FORM_macmode="${wl0_macmode:-$(nvram get wl0_macmode)}"
        FORM_lazywds=${wl0_lazywds:-$(nvram get wl0_lazywds)}
        case "$FORM_lazywds" in
-               0|off|disabled) FORM_lazywds=0;;
-               *) FORM_lazywds=1;;
+               1|on|enabled) FORM_lazywds=1;;
+               *) FORM_lazywds=0;;
        esac
 else
        SAVED=1
@@ -39,11 +34,11 @@ int|FORM_lazywds|Lazy WDS On/Off|required min=0 max=1|$FORM_lazywds
 EOF
        equal "$?" 0 && {
                save_setting wireless wl0_lazywds "$FORM_lazywds"
+               save_setting wireless wl0_macmode "$FORM_macmode"
        }
-       
 fi
 
-header "Network" "Advanced Wireless" "Advanced Wireless Settings" ' onLoad="modechange()"' "$SCRIPT_NAME"
+header "Network" "Advanced Wireless" "@TR<<Advanced Wireless Configuration>>" ' onLoad="modechange()"' "$SCRIPT_NAME"
 
 cat <<EOF
 <script type="text/javascript" src="/webif.js"></script>
@@ -55,32 +50,30 @@ function modechange() {
 }
 
 </script>
-<form enctype="multipart/form-data" method="post" action="$SCRIPT_NAME">
 EOF
 
 display_form <<EOF
 onchange|modechange
-start_form|WDS connections
+start_form|@TR<<WDS Connections>>
 listedit|wds|$SCRIPT_NAME?|$FORM_wds|$FORM_wdsadd
 end_form
-start_form|MAC filter list
+start_form|@TR<<MAC Filter List>>
 listedit|maclist|$SCRIPT_NAME?|$FORM_maclist|$FORM_maclistadd
-field
-caption|Filter mode: 
+end_form
+start_form|@TR<<Settings>>
+field|@TR<<Automatic WDS>>
+select|lazywds|$FORM_lazywds
+option|1|@TR<<Enabled>>
+option|0|@TR<<Disabled>>
+field|@TR<<Filter Mode>>:
 select|macmode|$FORM_macmode
-option|disabled
-option|allow
-option|deny
-submit|macmode_set|Set
-field|Lazy WDS 
-radio|lazywds|$FORM_lazywds|1|Enabled<br />
-radio|lazywds|$FORM_lazywds|0|Disabled
+option|disabled|@TR<<Disabled>>
+option|allow|@TR<<Allow>>
+option|deny|@TR<<Deny>>
 end_form
 EOF
 
-?>
-</form>
-<? footer ?>
+footer ?>
 <!--
 ##WEBIF:name:Network:4:Advanced Wireless
 -->
index e1e5e21f0fb28074b85876919a14fba7f57a24be..f069b74f1ef387ef9e8209dbf8d73a63b709fbe2 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
 <? 
 . /usr/lib/webif/webif.sh
 load_settings "wireless"
@@ -99,22 +99,22 @@ else
        SAVED=1
        case "$FORM_encryption" in
                wpa) V_RADIUS="
-string|FORM_radius_key|RADIUS server key|min=4 max=63 required|$FORM_radius_key
-ip|FORM_radius_ipaddr|RADIUS IP address|required|$FORM_radius_ipaddr";;
-               psk) V_PSK="wpapsk|FORM_wpa_psk|WPA pre-shared key|required|$FORM_wpa_psk";;
+string|FORM_radius_key|@TR<<RADIUS Server Key>>|min=4 max=63 required|$FORM_radius_key
+ip|FORM_radius_ipaddr|@TR<<RADIUS IP Address>>|required|$FORM_radius_ipaddr";;
+               psk) V_PSK="wpapsk|FORM_wpa_psk|@TR<<WPA PSK#WPA Pre-Shared Key>>|required|$FORM_wpa_psk";;
                wep) V_WEP="
-int|FORM_key|WEP key number|min=1 max=4|$FORM_key
-wep|FORM_key1|WEP key 1||$FORM_key1
-wep|FORM_key2|WEP key 2||$FORM_key2
-wep|FORM_key3|WEP key 3||$FORM_key3
-wep|FORM_key4|WEP key 4||$FORM_key4";;
+int|FORM_key|@TR<<Selected WEP Key>>|min=1 max=4|$FORM_key
+wep|FORM_key1|@TR<<WEP Key>> 1||$FORM_key1
+wep|FORM_key2|@TR<<WEP Key>> 2||$FORM_key2
+wep|FORM_key3|@TR<<WEP Key>> 3||$FORM_key3
+wep|FORM_key4|@TR<<WEP Key>> 4||$FORM_key4";;
        esac
 
        validate <<EOF
-int|FORM_radio|Radio On/Off|required min=0 max=1|$FORM_radio
-int|FORM_broadcast|Broadcast On/Off|required min=0 max=1|$FORM_broadcast
-string|FORM_ssid|ESSID|required|$FORM_ssid
-int|FORM_channel|Channel|required min=1 max=$CHANNEL_MAX|$FORM_channel
+int|FORM_radio|wl0_radio|required min=0 max=1|$FORM_radio
+int|FORM_broadcast|wl0_closed|required min=0 max=1|$FORM_broadcast
+string|FORM_ssid|@TR<<ESSID>>|required|$FORM_ssid
+int|FORM_channel|@TR<<Channel>>|required min=1 max=$CHANNEL_MAX|$FORM_channel
 $V_WEP
 $V_RADIUS
 $V_PSK
@@ -175,7 +175,7 @@ EOF
        }
 fi
 
-header "Network" "Wireless" "Wireless settings" ' onLoad="modechange()" ' "$SCRIPT_NAME"
+header "Network" "Wireless" "@TR<<Wireless Configuration>>" ' onLoad="modechange()" ' "$SCRIPT_NAME"
 
 cat <<EOF
 <script type="text/javascript" src="/webif.js"></script>
@@ -183,35 +183,32 @@ cat <<EOF
 <!--
 function modechange()
 {
-       if (checked('mode_adhoc')) {
-               var psk = document.getElementById('encryption_psk');
-               psk.disabled = true;
-               if (psk.checked) {
-                               psk.checked = false;
-                               document.getElementById('encryption_off').checked = true;
+       if (isset('mode','adhoc')) {
+               document.getElementById('encryption_psk').disabled = true;
+               if (isset('encryption','psk')) {
+                               document.getElementById('encryption').value = 'off';
                }
        } else {
                document.getElementById('encryption_psk').disabled = false;
        }
-       if (checked('mode_wet') || checked('mode_sta') || checked('mode_adhoc')) {
-               var wpa = document.getElementById('encryption_wpa');
-               wpa.disabled = true;
-               if (wpa.checked) {
-                               wpa.checked = false;
-                               document.getElementById('encryption_off').checked = true;
+       
+       if (!isset('mode','ap')) {
+               document.getElementById('encryption_wpa').disabled = true;
+               if (value('encryption') == 'wpa') {
+                               document.getElementById('encryption').value = 'off';
                }
        } else {
                document.getElementById('encryption_wpa').disabled = false;
        }
-       
-       var v = (checked('encryption_wpa') || checked('encryption_psk'));
+
+       var v = (isset('encryption','wpa') || isset('encryption','psk'));
        set_visible('wpa_support', v);
        set_visible('wpa_crypto', v);
        
-       set_visible('wpapsk', checked('encryption_psk'));
-       set_visible('wep_keys', checked('encryption_wep'));
+       set_visible('wpapsk', isset('encryption','psk'));
+       set_visible('wep_keys', isset('encryption','wep'));
 
-       v = checked('encryption_wpa');
+       v = isset('encryption','wpa');
        set_visible('radiuskey', v);
        set_visible('radius_ip', v);
 
@@ -225,48 +222,52 @@ EOF
 
 display_form <<EOF
 onchange|modechange
-start_form|Wireless Configuration
-field|Power
-radio|radio|$FORM_radio|1|Enabled<br />
-radio|radio|$FORM_radio|0|Disabled
-field|Broadcast
-radio|broadcast|$FORM_broadcast|0|Enabled<br />
-radio|broadcast|$FORM_broadcast|1|Disabled
-field|ESSID
+start_form|@TR<<Wireless Configuration>>
+field|@TR<<Wireless Interface>>
+select|radio|$FORM_radio
+option|1|@TR<<Enabled>>
+option|0|@TR<<Disabled>>
+field|@TR<<ESSID Broadcast>>
+select|broadcast|$FORM_broadcast
+option|0|@TR<<Show>>
+option|1|@TR<<Hide>>
+field|@TR<<ESSID>>
 text|ssid|$FORM_ssid
-helpitem|ESSID
-helptext|Name of your Wireless Network
-field|Channel
+helpitem|@TR<<ESSID>>
+helptext|@TR<<Helptext ESSID#Name of your Wireless Network>>
+field|@TR<<Channel>>
 select|channel|$FORM_channel
 $F_CHANNELS
-field|Mode
-radio|mode|$FORM_mode|ap|Access Point<br />
-radio|mode|$FORM_mode|sta|Client <br />
-radio|mode|$FORM_mode|wet|Bridge <br />
-radio|mode|$FORM_mode|adhoc|Ad-Hoc
-helpitem|Mode
-helptext|Operation mode
+field|@TR<<WLAN Mode#Mode>>
+select|mode|$FORM_mode
+option|ap|@TR<<Access Point>>
+option|sta|@TR<<Client>>
+option|wet|@TR<<Client>> (@TR<<Bridge>>)
+option|adhoc|@TR<<Ad-Hoc>>
+helpitem|@TR<<WLAN Mode#Mode>>
+helptext|@TR<<Operation mode>>
 helplink|http://wiki.openwrt.org/OpenWrtDocs/Configuration#head-7126c5958e237d603674b3a9739c9d23bdfdb293
 end_form
-start_form|Encryption settings
-field|Encryption type
-radio|encryption|$FORM_encryption|off|Disabled <br />
-radio|encryption|$FORM_encryption|wep|WEP <br />
-radio|encryption|$FORM_encryption|psk|WPA (preshared key) <br />
-radio|encryption|$FORM_encryption|wpa|WPA (RADIUS)
-field|WPA support|wpa_support|hidden
+start_form|@TR<<Encryption Settings>>
+field|@TR<<Encryption Type>>
+select|encryption|$FORM_encryption
+option|off|@TR<<Disabled>>
+option|wep|WEP
+option|psk|WPA (@TR<<PSK>>)
+option|wpa|WPA (RADIUS)
+field|@TR<<WPA Mode>>|wpa_support|hidden
 checkbox|wpa1|$FORM_wpa1|wpa1|WPA1
 checkbox|wpa2|$FORM_wpa2|wpa2|WPA2
-field|WPA encryption type|wpa_crypto|hidden
+field|@TR<<WPA Algorithms>>|wpa_crypto|hidden
 checkbox|tkip|$FORM_tkip|tkip|RC4 (TKIP)
 checkbox|aes|$FORM_aes|aes|AES
-field|WPA preshared key|wpapsk|hidden
+field|WPA @TR<<PSK>>|wpapsk|hidden
 text|wpa_psk|$FORM_wpa_psk
-field|RADIUS Server IP|radius_ip|hidden
+field|@TR<<RADIUS IP Address>>|radius_ip|hidden
 text|radius_ipaddr|$FORM_radius_ipaddr
-field|RADIUS Server Key|radiuskey|hidden
+field|@TR<<RADIUS Server Key>>|radiuskey|hidden
 text|radius_key|$FORM_radius_key
-field|WEP keys|wep_keys|hidden
+field|@TR<<WEP Keys>>|wep_keys|hidden
 radio|key|$FORM_key|1
 text|key1|$FORM_key1|<br />
 radio|key|$FORM_key|2
index b718a6eeb771316f690410afd2242c059baab322..47c044efaf04591eed0970842fa189583c0af572 100755 (executable)
@@ -1,7 +1,7 @@
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
 <? 
 . /usr/lib/webif/webif.sh
-header "Status" "Wireless" "Wireless status"
+header "Status" "Wireless" "@TR<<Wireless Status>>"
 ?>
 
 <pre><? iwconfig 2>&1 | grep -v 'no wireless' | grep '\w' ?></pre>
index 8bdef4dd66816b58f79548ddff231cd6fee273e7..64d26cd8b5b4311d8af4563c915d7c13465d081b 100644 (file)
@@ -3,6 +3,10 @@ function value(name)
        var item = document.getElementById(name);
        return (item ? item.value : "");
 }
+function isset(name, val)
+{
+       return (value(name) == val);
+}
 function checked(name)
 {
        var item = document.getElementById(name);
diff --git a/openwrt/package/webif/src/webif-page.c b/openwrt/package/webif/src/webif-page.c
new file mode 100644 (file)
index 0000000..f06071f
--- /dev/null
@@ -0,0 +1,246 @@
+/*
+ * Webif page translator
+ *
+ * Copyright (C) 2005 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glob.h>
+#include <ctype.h>
+#ifdef NVRAM
+#include <bcmnvram.h>
+#endif
+
+#define HASH_MAX       100
+#define LINE_BUF       1024 /* max. buffer allocated for one line */
+#define MAX_TR         32       /* max. translations done on one line */
+#define TR_START       "@TR<<"
+#define TR_END         ">>"
+
+struct lstr {
+       char *name;
+       char *value;
+       struct lstr *next;
+};
+typedef struct lstr lstr;
+
+static lstr *ltable[HASH_MAX];
+static char buf[LINE_BUF], buf2[LINE_BUF];
+
+/* djb2 hash function */
+static inline unsigned long hash(char *str)
+{
+       unsigned long hash = 5381;
+       int c;
+
+       while ((c = *str++))
+               hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
+       
+       return hash;
+}
+
+static inline char *translate_lookup(char *str)
+{
+       char *name, *def, *p, *res = NULL;
+       lstr *i;
+       int h;
+       
+       def = name = str;
+       if (((p = strchr(str, '|')) != NULL)
+               || ((p = strchr(str, '#')) != NULL)) {
+               def = p + 1;
+               *p = 0;
+       }
+       
+       h = hash(name) % HASH_MAX;
+       i = ltable[h];
+       while ((res == NULL) && (i != NULL)) {
+               if (strcmp(name, i->name) == 0)
+                       res = i->value;
+               i = i->next;
+       }
+       
+       if (res == NULL)
+               res = def;
+       
+       return res;
+}
+
+static inline void add_line(char *name, char *value)
+{
+       int h = hash(name) % HASH_MAX;
+       lstr *s = malloc(sizeof(lstr));
+       lstr *p;
+
+       s->name = strdup(name);
+       s->value = strdup(value);
+       s->next = NULL;
+       
+       if (ltable[h] == NULL)
+               ltable[h] = s;
+       else {
+               for(p = ltable[h]; p->next != NULL; p = p->next);
+               p->next = s;
+       }
+}
+
+static char *translate_line(char *line)
+{
+       static char *tok[MAX_TR * 3];
+       char *l, *p, *p2, *res;
+       int len = 0, pos = 0, i;
+
+       l = line;
+       while (l != NULL) {
+               if ((p = strstr(l, TR_START)) == NULL) {
+                       len += strlen((tok[pos++] = l));
+                       break;
+               }
+
+               p2 = strstr(p, TR_END);
+               if (p2 == NULL)
+                       break;
+
+               *p = 0;
+               *p2 = 0;
+               len += strlen((tok[pos++] = l));
+               len += strlen((tok[pos++] = translate_lookup(p + strlen(TR_START))));
+
+               l = p2;
+               l += strlen(TR_END);
+       }
+       len++;
+       
+       if (len > LINE_BUF)
+               p = malloc(len);
+       else
+               p = buf2;
+
+       p[0] = 0;
+       res = p;
+       for (i = 0; i < pos; i++) {
+               strcat(p, tok[i]);
+               p += strlen(tok[i]);
+       }
+
+       return res;
+}
+
+/* load and parse language file */
+static void load_lang(char *file)
+{
+       FILE *f;
+       char *b, *name, *value;
+
+       f = fopen(file, "r");
+       while (!feof(f) && (fgets(buf, LINE_BUF - 1, f) != NULL)) {
+               b = buf;
+               while (isspace(*b))
+                       b++; /* skip leading spaces */
+               if (!*b)
+                       continue;
+               
+               name = b;
+               if ((b = strstr(name, "=>")) == NULL)
+                       continue; /* separator not found */
+
+               value = b + 2;
+               if (!*value)
+                       continue;
+               
+               *b = 0;
+               for (b--; isspace(*b); b--)
+                       *b = 0; /* remove trailing spaces */
+               
+               while (isspace(*value))
+                       value++; /* skip leading spaces */
+
+               for (b = value + strlen(value) - 1; isspace(*b); b--)
+                       *b = 0; /* remove trailing spaces */
+               
+               if (!*value)
+                       continue;
+
+               add_line(name, value);
+       }
+}
+
+int main (int argc, char **argv)
+{
+       FILE *f;
+       int len, i;
+       char line[LINE_BUF];
+       glob_t langfiles;
+       char *lang = NULL;
+
+       memset(ltable, 0, HASH_MAX * sizeof(lstr *));
+#ifdef NVRAM
+       if ((lang = nvram_get("language")) != NULL) {
+#else
+       if ((f = fopen("/etc/config/webif", "r")) != NULL) {
+               int n, i;
+               
+               while (!feof(f) && (lang == NULL)) {
+                       fgets(line, LINE_BUF - 1, f);
+                       
+                       if (strncasecmp(line, "lang", 4) != 0)
+                               goto nomatch;
+                       
+                       lang = line + 4;
+                       while (isspace(*lang))
+                               lang++;
+                       
+                       if (*lang != '=')
+                               goto nomatch;
+
+                       lang++;
+
+                       while (isspace(*lang))
+                               lang++;
+
+                       for (i = 0; isalpha(lang[i]) && (i < 32); i++);
+                       lang[i] = 0;
+                       continue;
+nomatch:
+                       lang = NULL;
+               }
+               fclose(f);
+#endif
+
+               sprintf(buf, "/usr/lib/webif/lang/%s/*.txt", lang);
+               i = glob(buf, GLOB_ERR | GLOB_MARK, NULL, &langfiles);
+               if (i == GLOB_NOSPACE || i == GLOB_ABORTED || i == GLOB_NOMATCH) {
+                       // no language files found
+               } else {
+                       for (i = 0; i < langfiles.gl_pathc; --i) {
+                               load_lang(langfiles.gl_pathv[i]);
+                       }
+               }
+       }
+
+       i = 1;
+       strcpy(buf, "/usr/bin/haserl");
+       while (argv[i]) {
+               sprintf(buf + strlen(buf), " %s", argv[i++]);
+       }
+       f = popen(buf, "r");
+       
+       while (!feof(f) && (fgets(buf, LINE_BUF - 1, f)) != NULL) {
+               fprintf(stdout, "%s", translate_line(buf));
+       }
+       
+       return 0;
+}