slitaz-tools rev 569

tazbox: add locale and keymap config + up all POT files
author Christophe Lincoln <pankso@slitaz.org>
date Fri Apr 29 11:34:58 2011 +0200 (2011-04-29)
parents 513cf2248bf4
children c81e26d9f8ff
files Makefile po/scpbox/scpbox.pot po/subox/subox.pot po/tazbox/tazbox.pot po/tazctrlbox/tazctrlbox.pot po/tazdrop/tazdrop.pot tazbox/tazbox
line diff
     1.1 --- a/Makefile	Fri Apr 29 11:27:26 2011 +0200
     1.2 +++ b/Makefile	Fri Apr 29 11:34:58 2011 +0200
     1.3 @@ -12,12 +12,16 @@
     1.4  # i18n.
     1.5  
     1.6  tazbox-pot:
     1.7 -	xgettext -o po/tazbox/tazbox.pot -L Shell \
     1.8 +	@echo -n "Generating tazbox pot file... "
     1.9 +	@xgettext -o po/tazbox/tazbox.pot -L Shell \
    1.10  		--package-name="TazBox" ./tazbox/tazbox
    1.11 +	@echo "done"
    1.12  
    1.13  tazdrop-pot:
    1.14 -	xgettext -o po/tazdrop/tazdrop.pot -L Shell \
    1.15 +	@echo -n "Generating tazdrop pot file... "
    1.16 +	@xgettext -o po/tazdrop/tazdrop.pot -L Shell \
    1.17  		--package-name="TazDrop" ./tazdrop/tazdrop
    1.18 +	@echo "done"
    1.19  
    1.20  pot: tazbox-pot tazdrop-pot
    1.21  	@for p in $(TINYUTILS); do \
     2.1 --- a/po/scpbox/scpbox.pot	Fri Apr 29 11:27:26 2011 +0200
     2.2 +++ b/po/scpbox/scpbox.pot	Fri Apr 29 11:34:58 2011 +0200
     2.3 @@ -8,10 +8,11 @@
     2.4  msgstr ""
     2.5  "Project-Id-Version: scpbox\n"
     2.6  "Report-Msgid-Bugs-To: \n"
     2.7 -"POT-Creation-Date: 2011-04-18 19:05+0100\n"
     2.8 +"POT-Creation-Date: 2011-04-29 11:33+0200\n"
     2.9  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    2.10  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    2.11  "Language-Team: LANGUAGE <LL@li.org>\n"
    2.12 +"Language: \n"
    2.13  "MIME-Version: 1.0\n"
    2.14  "Content-Type: text/plain; charset=CHARSET\n"
    2.15  "Content-Transfer-Encoding: 8bit\n"
     3.1 --- a/po/subox/subox.pot	Fri Apr 29 11:27:26 2011 +0200
     3.2 +++ b/po/subox/subox.pot	Fri Apr 29 11:34:58 2011 +0200
     3.3 @@ -8,10 +8,11 @@
     3.4  msgstr ""
     3.5  "Project-Id-Version: subox\n"
     3.6  "Report-Msgid-Bugs-To: \n"
     3.7 -"POT-Creation-Date: 2011-04-18 19:05+0100\n"
     3.8 +"POT-Creation-Date: 2011-04-29 11:33+0200\n"
     3.9  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    3.10  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    3.11  "Language-Team: LANGUAGE <LL@li.org>\n"
    3.12 +"Language: \n"
    3.13  "MIME-Version: 1.0\n"
    3.14  "Content-Type: text/plain; charset=CHARSET\n"
    3.15  "Content-Transfer-Encoding: 8bit\n"
     4.1 --- a/po/tazbox/tazbox.pot	Fri Apr 29 11:27:26 2011 +0200
     4.2 +++ b/po/tazbox/tazbox.pot	Fri Apr 29 11:34:58 2011 +0200
     4.3 @@ -8,7 +8,7 @@
     4.4  msgstr ""
     4.5  "Project-Id-Version: TazBox\n"
     4.6  "Report-Msgid-Bugs-To: \n"
     4.7 -"POT-Creation-Date: 2011-04-18 19:05+0100\n"
     4.8 +"POT-Creation-Date: 2011-04-29 11:33+0200\n"
     4.9  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    4.10  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    4.11  "Language-Team: LANGUAGE <LL@li.org>\n"
    4.12 @@ -17,34 +17,74 @@
    4.13  "Content-Type: text/plain; charset=CHARSET\n"
    4.14  "Content-Transfer-Encoding: 8bit\n"
    4.15  
    4.16 -#: tazbox/tazbox:24
    4.17 +#: tazbox/tazbox:30
    4.18  msgid "Usage:"
    4.19  msgstr ""
    4.20  
    4.21 -#: tazbox/tazbox:26
    4.22 +#: tazbox/tazbox:32
    4.23  msgid "Commands:"
    4.24  msgstr ""
    4.25  
    4.26 -#: tazbox/tazbox:27
    4.27 +#: tazbox/tazbox:33
    4.28  msgid "Display this short help usage"
    4.29  msgstr ""
    4.30  
    4.31 -#: tazbox/tazbox:28
    4.32 -msgid "Desktop logout box"
    4.33 +#: tazbox/tazbox:34
    4.34 +msgid "Desktop logout box with actions"
    4.35  msgstr ""
    4.36  
    4.37  #: tazbox/tazbox:35
    4.38 +msgid "Pipe a command output into a GTK window"
    4.39 +msgstr ""
    4.40 +
    4.41 +#: tazbox/tazbox:36
    4.42 +msgid "Pipe Wget output into a GTK window"
    4.43 +msgstr ""
    4.44 +
    4.45 +#: tazbox/tazbox:37
    4.46 +msgid "Configure system language"
    4.47 +msgstr ""
    4.48 +
    4.49 +#: tazbox/tazbox:38
    4.50 +msgid "Configure system keymap"
    4.51 +msgstr ""
    4.52 +
    4.53 +#: tazbox/tazbox:59
    4.54  msgid "SliTaz Logout. Please choose an action:"
    4.55  msgstr ""
    4.56  
    4.57 -#: tazbox/tazbox:41
    4.58 +#: tazbox/tazbox:64
    4.59  msgid "Close X session"
    4.60  msgstr ""
    4.61  
    4.62 -#: tazbox/tazbox:42
    4.63 +#: tazbox/tazbox:65
    4.64  msgid "Reboot system"
    4.65  msgstr ""
    4.66  
    4.67 -#: tazbox/tazbox:43
    4.68 +#: tazbox/tazbox:66
    4.69  msgid "Shutdown system"
    4.70  msgstr ""
    4.71 +
    4.72 +#: tazbox/tazbox:71
    4.73 +msgid "Language configuration"
    4.74 +msgstr ""
    4.75 +
    4.76 +#: tazbox/tazbox:82
    4.77 +msgid "Name"
    4.78 +msgstr ""
    4.79 +
    4.80 +#: tazbox/tazbox:82
    4.81 +msgid "Description"
    4.82 +msgstr ""
    4.83 +
    4.84 +#: tazbox/tazbox:105
    4.85 +msgid "Keyborad configuration"
    4.86 +msgstr ""
    4.87 +
    4.88 +#: tazbox/tazbox:126
    4.89 +msgid "Keymap"
    4.90 +msgstr ""
    4.91 +
    4.92 +#: tazbox/tazbox:126
    4.93 +msgid "Type"
    4.94 +msgstr ""
     5.1 --- a/po/tazctrlbox/tazctrlbox.pot	Fri Apr 29 11:27:26 2011 +0200
     5.2 +++ b/po/tazctrlbox/tazctrlbox.pot	Fri Apr 29 11:34:58 2011 +0200
     5.3 @@ -8,10 +8,11 @@
     5.4  msgstr ""
     5.5  "Project-Id-Version: tazctrlbox\n"
     5.6  "Report-Msgid-Bugs-To: \n"
     5.7 -"POT-Creation-Date: 2011-04-18 19:05+0100\n"
     5.8 +"POT-Creation-Date: 2011-04-29 11:33+0200\n"
     5.9  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    5.10  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    5.11  "Language-Team: LANGUAGE <LL@li.org>\n"
    5.12 +"Language: \n"
    5.13  "MIME-Version: 1.0\n"
    5.14  "Content-Type: text/plain; charset=CHARSET\n"
    5.15  "Content-Transfer-Encoding: 8bit\n"
     6.1 --- a/po/tazdrop/tazdrop.pot	Fri Apr 29 11:27:26 2011 +0200
     6.2 +++ b/po/tazdrop/tazdrop.pot	Fri Apr 29 11:34:58 2011 +0200
     6.3 @@ -8,7 +8,7 @@
     6.4  msgstr ""
     6.5  "Project-Id-Version: TazDrop\n"
     6.6  "Report-Msgid-Bugs-To: \n"
     6.7 -"POT-Creation-Date: 2011-04-18 19:05+0100\n"
     6.8 +"POT-Creation-Date: 2011-04-29 11:33+0200\n"
     6.9  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    6.10  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    6.11  "Language-Team: LANGUAGE <LL@li.org>\n"
    6.12 @@ -17,26 +17,26 @@
    6.13  "Content-Type: text/plain; charset=CHARSET\n"
    6.14  "Content-Transfer-Encoding: 8bit\n"
    6.15  
    6.16 -#: tazdrop/tazdrop:30
    6.17 +#: tazdrop/tazdrop:32
    6.18  msgid "Usage:"
    6.19  msgstr ""
    6.20  
    6.21 -#: tazdrop/tazdrop:32
    6.22 +#: tazdrop/tazdrop:34
    6.23  msgid "Options:"
    6.24  msgstr ""
    6.25  
    6.26 -#: tazdrop/tazdrop:33
    6.27 +#: tazdrop/tazdrop:35
    6.28  msgid "Display this small help"
    6.29  msgstr ""
    6.30  
    6.31 -#: tazdrop/tazdrop:34
    6.32 +#: tazdrop/tazdrop:36
    6.33  msgid "Display the desktop Drag N' Drop window"
    6.34  msgstr ""
    6.35  
    6.36 -#: tazdrop/tazdrop:35
    6.37 +#: tazdrop/tazdrop:37
    6.38  msgid "Display your dropped text notes"
    6.39  msgstr ""
    6.40  
    6.41 -#: tazdrop/tazdrop:79
    6.42 +#: tazdrop/tazdrop:81
    6.43  msgid "Edit or clean-up your dropped text notes"
    6.44  msgstr ""
     7.1 --- a/tazbox/tazbox	Fri Apr 29 11:27:26 2011 +0200
     7.2 +++ b/tazbox/tazbox	Fri Apr 29 11:34:58 2011 +0200
     7.3 @@ -1,7 +1,7 @@
     7.4  #!/bin/sh
     7.5  #
     7.6 -# SliTaz tiny GUI boxes for the desktop (su, logout, etc) and as usual
     7.7 -# please KISS
     7.8 +# SliTaz tiny GUI boxes for the desktop (su, logout, locale, etc)
     7.9 +# and as usual, please: KISS
    7.10  #
    7.11  # Note: $(gettext "text") doesn't work inside Yad so use `gettext \"text\"`
    7.12  #
    7.13 @@ -34,10 +34,13 @@
    7.14    logout     $(gettext "Desktop logout box with actions")
    7.15    out        $(gettext "Pipe a command output into a GTK window")
    7.16    out-dl     $(gettext "Pipe Wget output into a GTK window")
    7.17 +  locale     $(gettext "Configure system language")
    7.18 +  keymap     $(gettext "Configure system keymap")
    7.19  
    7.20  EOT
    7.21  }
    7.22  
    7.23 +# User may press cancel on download.
    7.24  cancel_dl() {
    7.25  	if [ "$?" == 1 ]; then
    7.26  		echo "CANCEL"
    7.27 @@ -63,6 +66,78 @@
    7.28  			"`gettext \"Shutdown system\"` : halt"
    7.29  }
    7.30  
    7.31 +# Locale functions
    7.32 +locale_main() {
    7.33 +	text=$(gettext "Language configuration")
    7.34 +	db=/usr/share/i18n/locales
    7.35 +	for locale in $(ls -1 $db | grep ^[a-z][a-z]_[A-Z][A-Z])
    7.36 +	do
    7.37 +		desc=$(grep ^title $db/$locale | cut -d '"' -f 2)
    7.38 +		echo -e "$locale \n $desc"
    7.39 +	done | \
    7.40 +	yad --list $opts --title="SliTaz locale" --on-top \
    7.41 +		--width=500 --height=380 --separator="" \
    7.42 +		--image=preferences-desktop-locale --image-on-top \
    7.43 +		--text="<b>$text</b>" --print-column=1 \
    7.44 +		--column $(gettext "Name") --column $(gettext "Description")
    7.45 +}
    7.46 +
    7.47 +locale() {
    7.48 +	# Locale window with list
    7.49 +	locale=$(locale_main)
    7.50 +	# Deal with --button values
    7.51 +	case $? in
    7.52 +		1) exit 0 ;;
    7.53 +		*) continue ;;
    7.54 +	esac
    7.55 +	# Deal with $locale values
    7.56 +	[ "$locale" = "en" ] && locale="en_US"
    7.57 +	# User language configuration is in ~/.profile
    7.58 +	sed -i -e s"/LANG=.*/LANG=$locale/" \
    7.59 +		-e s"/LC_ALL=.*/LC_ALL=$locale/" $HOME/.profile
    7.60 +	# System language configuration via Tazlocale, on first boot
    7.61 +	# we have root for root passwd so we can configure system locale
    7.62 +	echo 'root' | su -c "tazlocale init $locale"
    7.63 +}
    7.64 +
    7.65 +# Keymap functions
    7.66 +keymap_main() {
    7.67 +	text=$(gettext "Keyborad configuration")
    7.68 +	tmp=/tmp/keymap.list
    7.69 +	echo > $tmp
    7.70 +	cd /usr/share/kbd/keymaps/i386
    7.71 +	# We first need a list to sort and then use \n fo Yad list.
    7.72 +	for i in $(find *rty *rtz dvorak -name *.map.gz)
    7.73 +	do
    7.74 +		keymap=$(basename $i)
    7.75 +		type=$(dirname $i)
    7.76 +		echo -e "$keymap|$type" >> $tmp
    7.77 +	done
    7.78 +	for i in $(sort $tmp)
    7.79 +	do
    7.80 +		keymap=$(echo $i | cut -d "|" -f 1)
    7.81 +		type=$(echo $i | cut -d "|" -f 2)
    7.82 +		echo -e "${keymap%.map.gz} \n $type"
    7.83 +	done | \
    7.84 +	yad --list $opts --title="SliTaz locale" \
    7.85 +		--width=500 --height=380 --separator="" \
    7.86 +		--image=input-keyboard --image-on-top \
    7.87 +		--text="<b>$text</b>" --print-column=1 \
    7.88 +		--column $(gettext "Keymap") --column $(gettext "Type")
    7.89 +}
    7.90 +
    7.91 +keymap() {
    7.92 +	# Locale window with list
    7.93 +	keymap=$(keymap_main)
    7.94 +	# Deal with --button values
    7.95 +	case $? in
    7.96 +		1) exit 0 ;;
    7.97 +		*) continue ;;
    7.98 +	esac
    7.99 +	[ "$keymap" ] && loadkeys $keymap
   7.100 +	#setxkbmap $keymap
   7.101 +}
   7.102 +
   7.103  #
   7.104  # Commands
   7.105  #
   7.106 @@ -92,6 +167,15 @@
   7.107  		url=$2
   7.108  		busybox wget -c -P $DOWNLOADS $url 2>&1 | output_command
   7.109  		cancel_dl ;;
   7.110 +	locale)
   7.111 +		locale ;;
   7.112 +	keymap)
   7.113 +		keymap ;;
   7.114 +	i18n)
   7.115 +		# This command is used at first login to configure user
   7.116 +		# environment.
   7.117 +		locale
   7.118 +		keymap ;;
   7.119  	*)
   7.120  		usage ;;
   7.121  esac