# HG changeset patch # User Aleksej Bobylev # Date 1428496340 -10800 # Node ID 169f1ccfb6131550b9bce6dbcb8f490ca9da180a # Parent ee21700899cc27f01764d52019409fe4be597aa0 Use short gettext commands; use $HTTP_HOST in redirection URL (for localhost 127.0.0.1:82 works too; for local network connection URL like 192.168.1.10:82 works). diff -r ee21700899cc -r 169f1ccfb613 Makefile --- a/Makefile Wed Apr 08 10:20:10 2015 +0200 +++ b/Makefile Wed Apr 08 15:32:20 2015 +0300 @@ -13,7 +13,7 @@ # i18n pot: - xgettext -o po/tazpanel.pot -L Shell \ + xgettext -o po/tazpanel.pot -L Shell -k_ -k_n -k_p:1,2 \ --package-name="TazPanel" \ --package-version="$(VERSION)" \ ./tazpanel ./index.cgi ./network.cgi ./boot.cgi \ diff -r ee21700899cc -r 169f1ccfb613 boot.cgi --- a/boot.cgi Wed Apr 08 10:20:10 2015 +0200 +++ b/boot.cgi Wed Apr 08 15:32:20 2015 +0300 @@ -13,7 +13,7 @@ get_config header -TITLE=$(gettext 'TazPanel - Boot') +TITLE=$(_ 'TazPanel - Boot') # Print last 40 lines of given file with "more" link @@ -24,7 +24,7 @@ *) tail -n40;; esac [ $(wc -l < $1) -gt 40 ] && cat <$(gettext 'Show more...') +
$(_ 'Show more...') EOT } @@ -53,13 +53,13 @@ esac xhtml_header cat <$(gettext 'Boot log files') +

$(_ 'Boot log files')

@@ -81,9 +81,9 @@ xhtml_header cat <$(gettext 'Manage daemons') +

$(_ 'Manage daemons')

-

$(gettext 'Check, start and stop daemons on SliTaz')

+

$(_ 'Check, start and stop daemons on SliTaz')

EOT daemon=$(GET daemons) case "$daemon" in @@ -107,12 +107,12 @@ - - - - - - + + + + + + @@ -135,32 +135,32 @@ [ -n "$(which $name)" ] && cfg="man|help|$cfg" case "$name" in firewall) - gettext 'SliTaz Firewall with iptable rules' ;; + _ 'SliTaz Firewall with iptable rules' ;; httpd) - gettext 'Small and fast web server with CGI support' ;; + _ 'Small and fast web server with CGI support' ;; ntpd) - gettext 'Network time protocol daemon' ;; + _ 'Network time protocol daemon' ;; ftpd) cfg="man|help|edit::/etc/inetd.conf" - gettext 'Anonymous FTP server' ;; + _ 'Anonymous FTP server' ;; udhcpd) - gettext 'Busybox DHCP server' ;; + _ 'Busybox DHCP server' ;; syslogd|klogd) - gettext 'Linux Kernel log daemon' ;; + _ 'Linux Kernel log daemon' ;; crond) # FIXME crontab - gettext 'Execute scheduled commands' ;; + _ 'Execute scheduled commands' ;; dnsd) cfg="man|help|edit|options::-d" - gettext 'Small static DNS server daemon' ;; + _ 'Small static DNS server daemon' ;; tftpd) cfg="man|help|edit::/etc/inetd.conf" - gettext 'Transfer a file on tftp request' ;; + _ 'Transfer a file on tftp request' ;; inetd) - gettext 'Listen for network connections and launch programs' ;; + _ 'Listen for network connections and launch programs' ;; zcip) cfg="man|help|edit:Script:/etc/zcip.script|options::eth0 /etc/zcip.script" - gettext 'Manage a ZeroConf IPv4 link-local address' ;; + _ 'Manage a ZeroConf IPv4 link-local address' ;; *) # Description from receipt [ -d "$LOCALSTATE/installed/$name" ] && pkg=$name @@ -229,8 +229,8 @@ echo "" if [ "$pid" ]; then cat < - + + - + +
$(gettext 'Name')$(gettext 'Description')$(gettext 'Configuration')$(gettext 'Status')$(gettext 'Action')$(gettext 'PID')$(_ 'Name')$(_ 'Description')$(_ 'Configuration')$(_ 'Status')$(_ 'Action')$(_ 'PID')
EOT for i in $pid; do @@ -240,8 +240,8 @@ done else cat < ----- EOT fi @@ -267,44 +267,44 @@ splash=$(cat $GRUBMENU | grep ^splashimage | cut -d' ' -f2) xhtml_header cat <$(gettext 'GRUB Boot loader') +

$(_ 'GRUB Boot loader')

-

$(gettext 'The first application started when the computer powers on')

+

$(_ 'The first application started when the computer powers on')

- + - + - +
$(gettext 'Default entry:')
$(_ 'Default entry:')
$(gettext 'Timeout:')
$(_ 'Timeout:')
$(gettext 'Splash image:')
$(_ 'Splash image:')
- +
- +
-
$(gettext 'Boot entries')
+
$(_ 'Boot entries')
EOT menu=$(tail -q -n +$(grep -n ^title $GRUBMENU | head -n1 | cut -d: -f1) $GRUBMENU | \ sed -e "s|^$||g" | \ - sed -e "s|^title|
\n
\n\n
\n\t
$(gettext 'Entry') #
\n
\0|g" | \
+	sed -e "s|^title|
\n
\n\n
\n\t
$(_ 'Entry') #
\n
\0|g" | \
 	sed '/^[ \t]*$/d' | \
 	tail -q -n +2)"
" @@ -325,7 +325,7 @@ [ -f "/boot/gpxe" ] && cat <
gPXE
-
$(gettext 'Web boot is available with gPXE')
+
$(_ 'Web boot is available with gPXE')
EOT ;; @@ -338,48 +338,48 @@ . /etc/rcS.conf xhtml_header cat <$(gettext 'Boot & Start services') +

$(_ 'Boot & Start services')

-

$(gettext 'Everything that happens before user login')

+

$(_ 'Everything that happens before user login')

- - + + EOT [ -w /boot/grub/menu.lst ] && cat <$(gettext 'Boot loader' ) + EOT cat <
-
$(gettext 'Configuration files')
+
$(_ 'Configuration files')
- - - - + + + +
$(gettext 'Main configuration file:') rcS.conf
$(gettext 'Login manager settings:') slim.conf
$(_ 'Main configuration file:') rcS.conf
$(_ 'Login manager settings:') slim.conf
-
$(gettext 'Kernel cmdline')
+
$(_ 'Kernel cmdline')
$(cat /proc/cmdline)
- $(gettext 'Local startup commands') + $(_ 'Local startup commands')
EOT [ -w /etc/init.d/local.sh ] && cat <$(gettext 'Edit') + EOT cat < diff -r ee21700899cc -r 169f1ccfb613 data/httpd.conf --- a/data/httpd.conf Wed Apr 08 10:20:10 2015 +0200 +++ b/data/httpd.conf Wed Apr 08 15:32:20 2015 +0300 @@ -16,3 +16,4 @@ *.cgi:/bin/sh # Additional MIME types .js:text/javascript +.ttf:application/x-font-ttf diff -r ee21700899cc -r 169f1ccfb613 hardware.cgi --- a/hardware.cgi Wed Apr 08 10:20:10 2015 +0200 +++ b/hardware.cgi Wed Apr 08 15:32:20 2015 +0300 @@ -10,7 +10,7 @@ get_config header -TITLE=$(gettext 'TazPanel - Hardware') +TITLE=$(_ 'TazPanel - Hardware') # Call an optional module lib() { @@ -32,10 +32,10 @@ - - - - + + + + @@ -87,8 +87,8 @@ # TODO: Add button to detect webcam, etc. Like in tazhw box. xhtml_header cat <$(gettext 'Detect hardware') -

$(gettext 'Detect PCI and USB hardware')

+

$(_ 'Detect hardware')

+

$(_ 'Detect PCI and USB hardware')

$(tazhw detect-pci | sed 's|^>|\>|g')
@@ -101,13 +101,12 @@ *\ modules\ *|*\ modinfo\ *) xhtml_header cat <$(gettext 'Kernel modules') +

$(_ 'Kernel modules')

+

$(_ 'Manage, search or get information about the Linux kernel modules')

- + - $(gettext 'Manage, search or get information about the Linux kernel modules') - - + EOT # Request may be modinfo output that we want in the page itself @@ -115,7 +114,7 @@ if [ -n "$get_modinfo" ]; then cat < -
$(eval_gettext 'Detailed information for module: $get_modinfo')
+
$(_ 'Detailed information for module: %s' $get_modinfo)
EOT modinfo $get_modinfo | awk 'BEGIN{print "
$(gettext 'Bus')$(gettext 'Device')$(gettext 'ID')$(gettext 'Name')$(_ 'Bus')$(_ 'Device')$(_ 'ID')$(_ 'Name')
"} @@ -135,13 +134,13 @@ fi get_search="$(GET search)" if [ -n "$get_search" ]; then - eval_gettext 'Matching result(s) for: $get_search' + _ 'Matching result(s) for: %s' $get_search echo '
'
 			modprobe -l | grep "$(GET search)" | while read line
 			do
 				name=$(basename $line)
 				mod=${name%.ko.gz}
-				echo "$(gettext 'Module:') $mod"
+				echo "$(_ 'Module:') $mod"
 			done
 			echo '
' fi @@ -150,11 +149,11 @@
- - - - - + + + + + @@ -178,9 +177,9 @@ xhtml_header vidpid="$(GET lsusb)" cat <$(eval_gettext 'Information for USB Device $vidpid') +

$(_ 'Information for USB Device %s' $vidpid)

-

$(gettext 'Detailed information about specified device.')

+

$(_ 'Detailed information about specified device.')

$(lsusb_table)
EOT @@ -196,9 +195,9 @@ xhtml_header slot="$(GET lspci)" cat <$(eval_gettext 'Information for PCI Device $slot') +

$(_ 'Information for PCI Device %s' $slot)

-

$(gettext 'Detailed information about specified device.')

+

$(_ 'Detailed information about specified device.')

$(lspci_table)
EOT @@ -219,13 +218,13 @@ # xhtml_header cat <$(gettext 'Drivers & Devices') -

$(gettext 'Manage your computer hardware')

+

$(_ 'Drivers & Devices')

+

$(_ 'Manage your computer hardware')

EOT @@ -235,7 +234,7 @@ if [ -n "$(ls /proc/acpi/battery/*/info 2>/dev/null)" ]; then cat < -
$(gettext 'Battery')
+
$(_ 'Battery')
$(gettext 'Module')$(gettext 'Description')$(gettext 'Size')$(gettext 'Used')$(gettext 'by')$(_ 'Module')$(_ 'Description')$(_ 'Size')$(_ 'Used')$(_ 'by')
EOT @@ -252,10 +251,10 @@ rempct=$(( $remain * 100 / $full )) cat < - - + - - - - - - + + + + + + @@ -500,17 +499,17 @@ # cat < -
$(gettext 'Loop devices')
+
$(_ 'Loop devices')
$(gettext 'Battery') + $(_ 'Battery') $(grep "^battery type" $dev/info | sed 's/.*: *//') $(grep "^design capacity:" $dev/info | sed 's/.*: *//') $(gettext 'health') $(( (100*$full)/$design))%$(_ 'health') $(( (100*$full)/$design))% @@ -264,13 +263,13 @@ "discharging") remtime=$(( $remain * 60 / $rate )) remtimef=$(printf "%d:%02d" $(($remtime/60)) $(($remtime%60))) - eval_gettext 'Discharging $rempct% - $remtimef' ;; + _ 'Discharging %d%% - %s' $rempct $remtimef ;; "charging") remtime=$(( ($full - $remain) * 60 / $rate )) remtimef=$(printf "%d:%02d" $(($remtime/60)) $(($remtime%60))) - eval_gettext 'Charging $rempct% - $remtimef' ;; + eval_gettext 'Charging %d%% - %s' $rempct $remtimef ;; "charged") - gettext 'Charged 100%' ;; + _ 'Charged 100%' ;; esac cat </dev/null)" ]; then - echo "

$(gettext 'Temperature:')" + echo "

$(_ 'Temperature:')" for temp in /sys/devices/virtual/thermal/*/temp; do awk '{ print $1/1000 "℃" }' < $temp done @@ -304,7 +303,7 @@ name=$(echo $dev | sed 's|.*/backlight/\([^/]*\).*|\1|') cat < -$(gettext 'Brightness') \ +$(_ 'Brightness') \ $(sed 's/.*\.//;s/_*$//' < /sys/devices/virtual/backlight/$name/device/path): - - + $(_ 'new mount point:') - + EOT cat <

- $(gettext 'Filesystems table') + $(_ 'Filesystems table') EOT [ -w /etc/fstab ] && cat < - + EOT cat <
$(gettext 'Disk')$(gettext 'Mount point')$(gettext 'Type')$(gettext 'Options')$(gettext 'Freq')$(gettext 'Pass')$(_ 'Disk')$(_ 'Mount point')$(_ 'Type')$(_ 'Options')$(_ 'Freq')$(_ 'Pass')
- - - - + + + + @@ -518,8 +517,8 @@ for devloop in $(ls /dev/*loop[0-9]*); do loop="${devloop#/dev/}" case "$(cat /sys/block/$loop/ro 2>/dev/null)" in - 0) ro="$(gettext "read/write")" ;; - 1) ro="$(gettext "read only")" ;; + 0) ro="$(_ "read/write")" ;; + 1) ro="$(_ "read only")" ;; *) ro="" ;; esac set -- $(losetup | grep ^$devloop:) ${ro// / } @@ -538,10 +537,10 @@ $(lib crypto input)
- - - $(gettext 'new backing file:') - - $(gettext 'offset in bytes:') - - + - + $(_ 'new backing file:') - + $(_ 'offset in bytes:') - +
@@ -558,16 +557,16 @@ cat < -
$(gettext 'System memory')
+
$(_ 'System memory')
${mem_used}%${mem_used}%${mem_buff}%${mem_buff}%${mem_free}%${mem_free}%
$(gettext 'Device')$(gettext 'Backing file')$(gettext 'Access')$(gettext 'Offset')$(_ 'Device')$(_ 'Backing file')$(_ 'Access')$(_ 'Offset')
diff -r ee21700899cc -r 169f1ccfb613 help.cgi --- a/help.cgi Wed Apr 08 10:20:10 2015 +0200 +++ b/help.cgi Wed Apr 08 15:32:20 2015 +0300 @@ -17,7 +17,7 @@ cat < EOT } @@ -25,7 +25,7 @@ # Cat translated help content -TITLE=$(gettext 'TazPanel - Help & Doc') +TITLE=$(_ 'TazPanel - Help & Doc') xhtml_header search_form diff -r ee21700899cc -r 169f1ccfb613 index.cgi --- a/index.cgi Wed Apr 08 10:20:10 2015 +0200 +++ b/index.cgi Wed Apr 08 15:32:20 2015 +0300 @@ -85,7 +85,7 @@ *\ exec\ *) # Execute command and display its result in a terminal-like window - header; TITLE=$(gettext 'TazPanel - exec'); xhtml_header + header; TITLE=$(_ 'TazPanel - exec'); xhtml_header exec="$(GET exec)" font="${TERM_FONT:-monospace}" @@ -117,7 +117,7 @@ *.html) cat $file; exit 0 ;; *) - TITLE=$(gettext 'TazPanel - File'); xhtml_header ;; + TITLE=$(_ 'TazPanel - File'); xhtml_header ;; esac case "$action" in @@ -127,8 +127,8 @@
$file
- - + +
@@ -146,7 +146,7 @@
- + EOT @@ -180,7 +180,7 @@ [ -w "$file" ] && cat < - $(file_is_modified $file button) EOT @@ -216,7 +216,7 @@ *\ terminal\ *|*\ cmd\ *) # Cmdline terminal - header; TITLE=$(gettext 'TazPanel - Terminal'); xhtml_header + header; TITLE=$(_ 'TazPanel - Terminal'); xhtml_header user="$REMOTE_USER" HOME="$(awk -F: -vu=$user '$1==u{print $6}' /etc/passwd)" @@ -237,14 +237,14 @@ cat <
- $(gettext 'History') -
+ $(_ 'History') +
 EOT
-			htmlize < $historyfile | awk -vrun="$(gettext 'run')" -vpath="$path" '
+			htmlize < $historyfile | awk -vrun="$(_ 'run')" -vpath="$path" '
 			BEGIN { num=1 }
 			{
 			printf("%3d ", num);
@@ -259,7 +259,7 @@
 			cat <
 		
- +
@@ -283,13 +283,13 @@ case "$cmd" in usage|help) - gettext 'Small non-interactive terminal emulator.'; echo - gettext 'Run any command at your own risk, avoid interactive commands (nano, mc, ...)'; echo + _ 'Small non-interactive terminal emulator.'; echo + _ 'Run any command at your own risk, avoid interactive commands (%s)' "nano, mc, ..."; echo ;; wget*) dl=/var/cache/downloads [ ! -d "$dl" ] && mkdir -p $dl - eval_gettext 'Downloading to: $dl'; echo + _ 'Downloading to: %s' $dl; echo cd $dl; $cmd 2>&1 ;; cd|cd\ *) path="${cmd#cd}"; path="${path:-$HOME}"; @@ -298,10 +298,10 @@ $cmd -w80 --color=always 2>&1 | filter_taztools_msgs ;; cat) # Cmd must be used with an arg. - eval_gettext '$cmd needs an argument' ;; - mc|nano) + _ '%s needs an argument' "$cmd" ;; + mc|nano|su) # List of restricted (interactive) commands - eval_gettext "Please, don't run interactive command \"$cmd\""; echo; echo ;; + _ "Please, don't run interactive command \"%s\"" "$cmd"; echo; echo ;; *) unset HTTP_REFERER # for fooling /lib/libtaz.sh formatting utils (
in the terminal is so-so) export DISPLAY=:0.0 # for run X applications @@ -319,8 +319,8 @@
- - + + \n' $(cd /var/www/tazpanel; ls lib/*.js)) @@ -19,62 +20,62 @@