slitaz-base-files rev 193

remove unboldify(), add emsg(); small fix i18n; make pot && make msgmerge, up ru.po
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sun Jun 03 14:09:18 2012 +0000 (2012-06-03)
parents 1c8307dbe719
children bbdd70de8552
files doc/libtaz.txt po/fr.po po/ru.po po/slitaz-base.pot rootfs/lib/libtaz.sh rootfs/usr/bin/man rootfs/usr/lib/slitaz/libpkg.sh testsuite.sh
line diff
     1.1 --- a/doc/libtaz.txt	Sat Jun 02 18:05:40 2012 -0500
     1.2 +++ b/doc/libtaz.txt	Sun Jun 03 14:09:18 2012 +0000
     1.3 @@ -16,8 +16,9 @@
     1.4  	separator             Display a line separator
     1.5  	newline               Echo a new line if gettext or echo -n is used
     1.6  	boldify [string]      Use a bold font for term, html or GTK output
     1.7 -	colorize [string] NB  Colorize a string in term mode
     1.8 +	colorize NB [string]  Colorize a string in term mode
     1.9  	indent NB [string]    Indent text in term mode
    1.10 +	emsg [string]         Output mark up messages
    1.11  	check_root            Check if user is logged as root
    1.12  	debug [string]        Display a DEBUG message when --debug is used
    1.13  	confirm               Read answer to confirm an action
    1.14 @@ -30,6 +31,7 @@
    1.15  EXAMPLES
    1.16  	log "Message"
    1.17  	check_root
    1.18 +	emsg "<b>bold</b> <c 31>red</c> <c 32>green</c> separator<-> newline<n> <i 26>indent"
    1.19  
    1.20  AUTHORS
    1.21  	Written by Christophe Lincoln
     2.1 --- a/po/fr.po	Sat Jun 02 18:05:40 2012 -0500
     2.2 +++ b/po/fr.po	Sun Jun 03 14:09:18 2012 +0000
     2.3 @@ -1,13 +1,13 @@
     2.4 -# French translations for SliTaz package.
     2.5 +# French translations for SliTaz Base package.
     2.6  # Copyright (C) 2012 THE SliTaz'S COPYRIGHT HOLDER
     2.7 -# This file is distributed under the same license as the SliTaz package.
     2.8 +# This file is distributed under the same license as the SliTaz Base package.
     2.9  # Christophe Lincoln <pankso@slitaz.org>, 2012.
    2.10  #
    2.11  msgid ""
    2.12  msgstr ""
    2.13  "Project-Id-Version: SliTaz Base\n"
    2.14  "Report-Msgid-Bugs-To: \n"
    2.15 -"POT-Creation-Date: 2012-05-21 11:30+0300\n"
    2.16 +"POT-Creation-Date: 2012-06-03 14:03+0000\n"
    2.17  "PO-Revision-Date: 2012-05-17 09:09+0100\n"
    2.18  "Last-Translator: Christophe Lincoln <pankso@slitaz.org>\n"
    2.19  "Language-Team: French\n"
    2.20 @@ -17,38 +17,51 @@
    2.21  "Content-Transfer-Encoding: 8bit\n"
    2.22  "Plural-Forms: nplurals=2; plural=(n > 1);\n"
    2.23  
    2.24 -#: rootfs/lib/libtaz.sh:28
    2.25 +#: rootfs/lib/libtaz.sh:25
    2.26  msgid "Done"
    2.27  msgstr "Fait"
    2.28  
    2.29 -#: rootfs/lib/libtaz.sh:29
    2.30 +#: rootfs/lib/libtaz.sh:26
    2.31  msgid "Failed"
    2.32  msgstr "Echec"
    2.33  
    2.34 -#: rootfs/lib/libtaz.sh:132
    2.35 +#: rootfs/lib/libtaz.sh:155
    2.36  msgid "You must be root to execute:"
    2.37  msgstr "Vous devez être root pour exécuter:"
    2.38  
    2.39 -#: rootfs/lib/libtaz.sh:145
    2.40 +#: rootfs/lib/libtaz.sh:168
    2.41  msgid "y"
    2.42  msgstr "o"
    2.43  
    2.44 -#: rootfs/lib/libtaz.sh:146
    2.45 +#: rootfs/lib/libtaz.sh:169
    2.46  msgid "Y"
    2.47  msgstr "O"
    2.48  
    2.49 -#: rootfs/lib/libtaz.sh:147
    2.50 +#: rootfs/lib/libtaz.sh:170
    2.51  msgid "n"
    2.52  msgstr "n"
    2.53  
    2.54 -#: rootfs/lib/libtaz.sh:148
    2.55 +#: rootfs/lib/libtaz.sh:171
    2.56  msgid "N"
    2.57  msgstr "N"
    2.58  
    2.59 -#: rootfs/usr/lib/slitaz/libpkg.sh:32
    2.60 -#, fuzzy, sh-format
    2.61 +#: rootfs/usr/lib/slitaz/libpkg.sh:33
    2.62 +msgid "Mirror is unreachable"
    2.63 +msgstr ""
    2.64 +
    2.65 +#: rootfs/usr/lib/slitaz/libpkg.sh:37
    2.66 +msgid "Mirror is up-to-date"
    2.67 +msgstr ""
    2.68 +
    2.69 +#: rootfs/usr/lib/slitaz/libpkg.sh:46
    2.70 +#, sh-format
    2.71 +msgid "Missing receipt: $receipt"
    2.72 +msgstr ""
    2.73 +
    2.74 +#: rootfs/usr/lib/slitaz/libpkg.sh:66
    2.75 +#, sh-format
    2.76  msgid "$file is not a tazpkg. Exiting"
    2.77 -msgstr "n'est pas un tazpkg. Arrêt"
    2.78 +msgstr "$file n'est pas un tazpkg. Arrêt"
    2.79  
    2.80  #: rootfs/var/www/cgi-bin/cgi-env.sh:17 rootfs/var/www/cgi-bin/cgi-env.sh:24
    2.81  msgid "CGI SHell Environment"
    2.82 @@ -96,6 +109,11 @@
    2.83  msgid "<b>Usage:</b> man [section] command"
    2.84  msgstr ""
    2.85  
    2.86 +#: rootfs/usr/bin/man:43
    2.87 +#, sh-format
    2.88 +msgid "in section $SECTION"
    2.89 +msgstr ""
    2.90 +
    2.91  #: rootfs/usr/bin/man:78
    2.92  #, sh-format
    2.93  msgid "No manual entry for $TOPIC$MSG"
     3.1 --- a/po/ru.po	Sat Jun 02 18:05:40 2012 -0500
     3.2 +++ b/po/ru.po	Sun Jun 03 14:09:18 2012 +0000
     3.3 @@ -7,8 +7,8 @@
     3.4  msgstr ""
     3.5  "Project-Id-Version: SliTaz Base\n"
     3.6  "Report-Msgid-Bugs-To: \n"
     3.7 -"POT-Creation-Date: 2012-05-21 11:30+0300\n"
     3.8 -"PO-Revision-Date: 2012-05-21 11:32+0300\n"
     3.9 +"POT-Creation-Date: 2012-06-03 14:03+0000\n"
    3.10 +"PO-Revision-Date: 2012-06-03 14:06-0000\n"
    3.11  "Last-Translator: Aleksej Bobylev <al.bobylev@gmail.com>\n"
    3.12  "Language-Team: \n"
    3.13  "Language: ru\n"
    3.14 @@ -19,38 +19,51 @@
    3.15  "X-Poedit-Basepath: ../\n"
    3.16  "X-Poedit-SearchPath-0: .\n"
    3.17  
    3.18 -#: rootfs/lib/libtaz.sh:28
    3.19 +#: rootfs/lib/libtaz.sh:25
    3.20  msgid "Done"
    3.21  msgstr "Готово"
    3.22  
    3.23 -#: rootfs/lib/libtaz.sh:29
    3.24 +#: rootfs/lib/libtaz.sh:26
    3.25  msgid "Failed"
    3.26  msgstr "Ошибка"
    3.27  
    3.28 -#: rootfs/lib/libtaz.sh:132
    3.29 +#: rootfs/lib/libtaz.sh:155
    3.30  msgid "You must be root to execute:"
    3.31  msgstr "Вы должны обладать правами root для запуска:"
    3.32  
    3.33 -#: rootfs/lib/libtaz.sh:145
    3.34 +#: rootfs/lib/libtaz.sh:168
    3.35  msgid "y"
    3.36  msgstr ""
    3.37  
    3.38 -#: rootfs/lib/libtaz.sh:146
    3.39 +#: rootfs/lib/libtaz.sh:169
    3.40  msgid "Y"
    3.41  msgstr ""
    3.42  
    3.43 -#: rootfs/lib/libtaz.sh:147
    3.44 +#: rootfs/lib/libtaz.sh:170
    3.45  msgid "n"
    3.46  msgstr ""
    3.47  
    3.48 -#: rootfs/lib/libtaz.sh:148
    3.49 +#: rootfs/lib/libtaz.sh:171
    3.50  msgid "N"
    3.51  msgstr ""
    3.52  
    3.53 -#: rootfs/usr/lib/slitaz/libpkg.sh:32
    3.54 +#: rootfs/usr/lib/slitaz/libpkg.sh:33
    3.55 +msgid "Mirror is unreachable"
    3.56 +msgstr "Зеркало недоступно"
    3.57 +
    3.58 +#: rootfs/usr/lib/slitaz/libpkg.sh:37
    3.59 +msgid "Mirror is up-to-date"
    3.60 +msgstr "Зеркало в актуальном состоянии"
    3.61 +
    3.62 +#: rootfs/usr/lib/slitaz/libpkg.sh:46
    3.63 +#, sh-format
    3.64 +msgid "Missing receipt: $receipt"
    3.65 +msgstr "Отсутствует рецепт: $receipt"
    3.66 +
    3.67 +#: rootfs/usr/lib/slitaz/libpkg.sh:66
    3.68  #, sh-format
    3.69  msgid "$file is not a tazpkg. Exiting"
    3.70 -msgstr "Файл $file не является пакетом. Выход"
    3.71 +msgstr "Файл $file не является пакетом tazpkg. Выход"
    3.72  
    3.73  #: rootfs/var/www/cgi-bin/cgi-env.sh:17
    3.74  #: rootfs/var/www/cgi-bin/cgi-env.sh:24
    3.75 @@ -95,6 +108,11 @@
    3.76  msgid "<b>Usage:</b> man [section] command"
    3.77  msgstr "<b>Использование:</b> man [раздел] команда"
    3.78  
    3.79 +#: rootfs/usr/bin/man:43
    3.80 +#, sh-format
    3.81 +msgid "in section $SECTION"
    3.82 +msgstr "в разделе $SECTION"
    3.83 +
    3.84  #: rootfs/usr/bin/man:78
    3.85  #, sh-format
    3.86  msgid "No manual entry for $TOPIC$MSG"
     4.1 --- a/po/slitaz-base.pot	Sat Jun 02 18:05:40 2012 -0500
     4.2 +++ b/po/slitaz-base.pot	Sun Jun 03 14:09:18 2012 +0000
     4.3 @@ -8,7 +8,7 @@
     4.4  msgstr ""
     4.5  "Project-Id-Version: SliTaz Base\n"
     4.6  "Report-Msgid-Bugs-To: \n"
     4.7 -"POT-Creation-Date: 2012-05-21 11:30+0300\n"
     4.8 +"POT-Creation-Date: 2012-06-03 14:03+0000\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,35 +17,48 @@
    4.13  "Content-Type: text/plain; charset=CHARSET\n"
    4.14  "Content-Transfer-Encoding: 8bit\n"
    4.15  
    4.16 -#: rootfs/lib/libtaz.sh:28
    4.17 +#: rootfs/lib/libtaz.sh:25
    4.18  msgid "Done"
    4.19  msgstr ""
    4.20  
    4.21 -#: rootfs/lib/libtaz.sh:29
    4.22 +#: rootfs/lib/libtaz.sh:26
    4.23  msgid "Failed"
    4.24  msgstr ""
    4.25  
    4.26 -#: rootfs/lib/libtaz.sh:132
    4.27 +#: rootfs/lib/libtaz.sh:155
    4.28  msgid "You must be root to execute:"
    4.29  msgstr ""
    4.30  
    4.31 -#: rootfs/lib/libtaz.sh:145
    4.32 +#: rootfs/lib/libtaz.sh:168
    4.33  msgid "y"
    4.34  msgstr ""
    4.35  
    4.36 -#: rootfs/lib/libtaz.sh:146
    4.37 +#: rootfs/lib/libtaz.sh:169
    4.38  msgid "Y"
    4.39  msgstr ""
    4.40  
    4.41 -#: rootfs/lib/libtaz.sh:147
    4.42 +#: rootfs/lib/libtaz.sh:170
    4.43  msgid "n"
    4.44  msgstr ""
    4.45  
    4.46 -#: rootfs/lib/libtaz.sh:148
    4.47 +#: rootfs/lib/libtaz.sh:171
    4.48  msgid "N"
    4.49  msgstr ""
    4.50  
    4.51 -#: rootfs/usr/lib/slitaz/libpkg.sh:32
    4.52 +#: rootfs/usr/lib/slitaz/libpkg.sh:33
    4.53 +msgid "Mirror is unreachable"
    4.54 +msgstr ""
    4.55 +
    4.56 +#: rootfs/usr/lib/slitaz/libpkg.sh:37
    4.57 +msgid "Mirror is up-to-date"
    4.58 +msgstr ""
    4.59 +
    4.60 +#: rootfs/usr/lib/slitaz/libpkg.sh:46
    4.61 +#, sh-format
    4.62 +msgid "Missing receipt: $receipt"
    4.63 +msgstr ""
    4.64 +
    4.65 +#: rootfs/usr/lib/slitaz/libpkg.sh:66
    4.66  #, sh-format
    4.67  msgid "$file is not a tazpkg. Exiting"
    4.68  msgstr ""
    4.69 @@ -96,6 +109,11 @@
    4.70  msgid "<b>Usage:</b> man [section] command"
    4.71  msgstr ""
    4.72  
    4.73 +#: rootfs/usr/bin/man:43
    4.74 +#, sh-format
    4.75 +msgid "in section $SECTION"
    4.76 +msgstr ""
    4.77 +
    4.78  #: rootfs/usr/bin/man:78
    4.79  #, sh-format
    4.80  msgid "No manual entry for $TOPIC$MSG"
     5.1 --- a/rootfs/lib/libtaz.sh	Sat Jun 02 18:05:40 2012 -0500
     5.2 +++ b/rootfs/lib/libtaz.sh	Sun Jun 03 14:09:18 2012 +0000
     5.3 @@ -98,18 +98,7 @@
     5.4  	esac
     5.5  }
     5.6  
     5.7 -# Better to keep messages unsplitted
     5.8 -# Example: unboldify "My <b>pretty</b> function ;)"
     5.9 -unboldify() {
    5.10 -	case $output in
    5.11 -		raw)	echo "$@" | sed -e 's|<b>||g;s|</b>||g' ;;
    5.12 -		gtk)	echo "$@" ;;
    5.13 -		html)	echo "$@" | sed -e 's|<b>|<strong>|g;s|</b>|</strong>|g' ;;
    5.14 -		*)		echo -e "$(echo "$@" | sed -e 's|<b>|\\033[1m|g;s|</b>|\\033[0m|g')" ;;
    5.15 -	esac
    5.16 -}
    5.17 -
    5.18 -# Usage: colorize "Message" colorNB or use --color=NB option
    5.19 +# Usage: colorize colorNB "Message"  or use --color=NB option
    5.20  # when running a tool. Default to white/38 and no html or gtk.
    5.21  colorize() {
    5.22  	: ${color=$1}
    5.23 @@ -131,6 +120,35 @@
    5.24  	echo -e "\033["$in"G $@";
    5.25  }
    5.26  
    5.27 +# Extended MeSsaGe output
    5.28 +emsg() {
    5.29 +	local sep="\n--------\n"
    5.30 +	case $output in
    5.31 +		raw)
    5.32 +			echo "$@" | sed -e 's|<b>||g; s|</b>||g; s|<c [0-9]*>||g; \
    5.33 +			s|</c>||g; s|<->|'$sep'|g; s|<n>|\n|g; s|<i [0-9]*>| |g' ;;
    5.34 +		gtk)
    5.35 +			echo "$@" | sed -e 's|<c [0-9]*>||g; s|</c>||g; s|<->|'$sep'|g; \
    5.36 +			s|<n>|\n|g; s|<i [0-9]*>| |g' ;;
    5.37 +		html)
    5.38 +			echo "$@" | sed -e 's|<b>|<strong>|g; s|</b>|</strong>|g; \
    5.39 +			s|<n>|<br/>|g; s|<->|<hr/>|g; s|<i [0-9]*>| |g' ;;
    5.40 +		*)
    5.41 +			local sep="\n"
    5.42 +			local cols=$(get_cols)
    5.43 +			[ "$cols" ] || cols=80
    5.44 +			for c in $(seq 1 $cols)
    5.45 +			do
    5.46 +				sep="${sep}="
    5.47 +			done
    5.48 +			echo -en "$(echo "$@" | sed -e 's|<b>|\\033[1m|g; s|</b>|\\033[0m|g; \
    5.49 +			s|<c \([0-9]*\)>|\\033[1;\1m|g; s|</c>|\\033[0;39m|g; s|<n>|\n|g; \
    5.50 +			s|<->|'$sep'|g; s|<i \([0-9]*\)>|\\033[\1G|g')"
    5.51 +			[ "$1" != "-n" ] && echo
    5.52 +			;;
    5.53 +	esac
    5.54 +}
    5.55 +
    5.56  # Check if user is logged as root.
    5.57  check_root() {
    5.58  	if [ $(id -u) != 0 ]; then
    5.59 @@ -141,7 +159,7 @@
    5.60  
    5.61  # Display debug info when --debug is used.
    5.62  debug() {
    5.63 -	[ "$debug" ] && echo "$(colorize $decolor "DEBUG:") $1"
    5.64 +	[ "$debug" ] && echo "$(colorize $decolor 'DEBUG:') $1"
    5.65  }
    5.66  
    5.67  # Gettextize yes/no.
     6.1 --- a/rootfs/usr/bin/man	Sat Jun 02 18:05:40 2012 -0500
     6.2 +++ b/rootfs/usr/bin/man	Sun Jun 03 14:09:18 2012 +0000
     6.3 @@ -27,7 +27,7 @@
     6.4  	''|-*)
     6.5  		cat <<EOT
     6.6  
     6.7 -unboldify "$(gettext '<b>Usage:</b> man [section] command')"
     6.8 +emsg "$(gettext '<b>Usage:</b> man [section] command')"
     6.9  
    6.10  EOT
    6.11  		return ;;
    6.12 @@ -40,7 +40,7 @@
    6.13  if [ -n "$2" ]; then
    6.14  	SECTION=$1
    6.15  	MAN_SECTION=$1
    6.16 -	MSG=" in section $SECTION"
    6.17 +	MSG=" $(eval_gettext 'in section $SECTION')"
    6.18  	shift
    6.19  fi
    6.20  
    6.21 @@ -58,7 +58,7 @@
    6.22  	return
    6.23  fi
    6.24  
    6.25 -for i in /usr/share/$LC_ALL/man$MAN_SECTION /usr/share/man$MAN_SECTION; do
    6.26 +for i in /usr/share/man/$LC_ALL/man$MAN_SECTION /usr/share/man/man$MAN_SECTION; do
    6.27  	if [ -f $i/raw-$TOPIC.* ]; then
    6.28  		i=$(ls $i/raw-$TOPIC.*)
    6.29  		case "$i" in
     7.1 --- a/rootfs/usr/lib/slitaz/libpkg.sh	Sat Jun 02 18:05:40 2012 -0500
     7.2 +++ b/rootfs/usr/lib/slitaz/libpkg.sh	Sun Jun 03 14:09:18 2012 +0000
     7.3 @@ -43,7 +43,7 @@
     7.4  source_receipt() {
     7.5  		local receipt=$1
     7.6  		if [ ! -f $receipt ]; then
     7.7 -			indent 28 $(gettext "Missing receipt: ") $receipt
     7.8 +			indent 28 $(eval_gettext 'Missing receipt: $receipt')
     7.9  			continue
    7.10  		else
    7.11  			. $receipt
    7.12 @@ -63,8 +63,7 @@
    7.13  check_valid_tazpkg() {
    7.14  	local file=$1
    7.15  	if ! is_valid_tazpkg $file; then
    7.16 -		echo -n "$file "
    7.17 -		gettext "is not a tazpkg. Exiting"; newline
    7.18 +		eval_gettext "\$file is not a tazpkg. Exiting"; newline
    7.19  		exit 1
    7.20  	fi
    7.21  }
     8.1 --- a/testsuite.sh	Sat Jun 02 18:05:40 2012 -0500
     8.2 +++ b/testsuite.sh	Sun Jun 03 14:09:18 2012 +0000
     8.3 @@ -13,9 +13,6 @@
     8.4  	echo -n "Checking libtaz.sh: boldify() "
     8.5  	boldify "Message"
     8.6  
     8.7 -	echo -n "Checking libtaz.sh: unboldify() "
     8.8 -	unboldify "It's a <b>sample</b> message"
     8.9 -
    8.10  	echo -n "Checking libtaz.sh: colorize() "
    8.11  	echo -n $(colorize 33 "Message ")
    8.12  	echo -n $(colorize 35 "Message ")
    8.13 @@ -23,6 +20,9 @@
    8.14  
    8.15  	echo "Checking libtaz.sh: separator"
    8.16  	separator
    8.17 +
    8.18 +	echo -n "Checking libtaz.sh: emsg() "
    8.19 +	emsg "<b>bold</b> color: <c 31>bold red</c> <c 32>bold green</c> separator:<->newline:<n> message with<i 26>indent"
    8.20  }
    8.21  
    8.22  # Usage: check_functions path/to/lib.sh
    8.23 @@ -59,7 +59,7 @@
    8.24  
    8.25  check_libtaz
    8.26  output="raw"
    8.27 -echo "Checking libtaz.sh: --output=raw"
    8.28 +echo -e "\nChecking libtaz.sh: --output=raw"
    8.29  check_libtaz
    8.30  
    8.31  # Check libtaz.sh functions usage