# HG changeset patch # User Aleksej Bobylev # Date 1338732558 0 # Node ID d4df77afbed67f86a280af36ad4e98fda692b0ee # Parent 1c8307dbe7197314f93f1ea9a10ce8ac67597fc8 remove unboldify(), add emsg(); small fix i18n; make pot && make msgmerge, up ru.po diff -r 1c8307dbe719 -r d4df77afbed6 doc/libtaz.txt --- a/doc/libtaz.txt Sat Jun 02 18:05:40 2012 -0500 +++ b/doc/libtaz.txt Sun Jun 03 14:09:18 2012 +0000 @@ -16,8 +16,9 @@ separator Display a line separator newline Echo a new line if gettext or echo -n is used boldify [string] Use a bold font for term, html or GTK output - colorize [string] NB Colorize a string in term mode + colorize NB [string] Colorize a string in term mode indent NB [string] Indent text in term mode + emsg [string] Output mark up messages check_root Check if user is logged as root debug [string] Display a DEBUG message when --debug is used confirm Read answer to confirm an action @@ -30,6 +31,7 @@ EXAMPLES log "Message" check_root + emsg "bold red green separator<-> newline indent" AUTHORS Written by Christophe Lincoln diff -r 1c8307dbe719 -r d4df77afbed6 po/fr.po --- a/po/fr.po Sat Jun 02 18:05:40 2012 -0500 +++ b/po/fr.po Sun Jun 03 14:09:18 2012 +0000 @@ -1,13 +1,13 @@ -# French translations for SliTaz package. +# French translations for SliTaz Base package. # Copyright (C) 2012 THE SliTaz'S COPYRIGHT HOLDER -# This file is distributed under the same license as the SliTaz package. +# This file is distributed under the same license as the SliTaz Base package. # Christophe Lincoln , 2012. # msgid "" msgstr "" "Project-Id-Version: SliTaz Base\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-05-21 11:30+0300\n" +"POT-Creation-Date: 2012-06-03 14:03+0000\n" "PO-Revision-Date: 2012-05-17 09:09+0100\n" "Last-Translator: Christophe Lincoln \n" "Language-Team: French\n" @@ -17,38 +17,51 @@ "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: rootfs/lib/libtaz.sh:28 +#: rootfs/lib/libtaz.sh:25 msgid "Done" msgstr "Fait" -#: rootfs/lib/libtaz.sh:29 +#: rootfs/lib/libtaz.sh:26 msgid "Failed" msgstr "Echec" -#: rootfs/lib/libtaz.sh:132 +#: rootfs/lib/libtaz.sh:155 msgid "You must be root to execute:" msgstr "Vous devez être root pour exécuter:" -#: rootfs/lib/libtaz.sh:145 +#: rootfs/lib/libtaz.sh:168 msgid "y" msgstr "o" -#: rootfs/lib/libtaz.sh:146 +#: rootfs/lib/libtaz.sh:169 msgid "Y" msgstr "O" -#: rootfs/lib/libtaz.sh:147 +#: rootfs/lib/libtaz.sh:170 msgid "n" msgstr "n" -#: rootfs/lib/libtaz.sh:148 +#: rootfs/lib/libtaz.sh:171 msgid "N" msgstr "N" -#: rootfs/usr/lib/slitaz/libpkg.sh:32 -#, fuzzy, sh-format +#: rootfs/usr/lib/slitaz/libpkg.sh:33 +msgid "Mirror is unreachable" +msgstr "" + +#: rootfs/usr/lib/slitaz/libpkg.sh:37 +msgid "Mirror is up-to-date" +msgstr "" + +#: rootfs/usr/lib/slitaz/libpkg.sh:46 +#, sh-format +msgid "Missing receipt: $receipt" +msgstr "" + +#: rootfs/usr/lib/slitaz/libpkg.sh:66 +#, sh-format msgid "$file is not a tazpkg. Exiting" -msgstr "n'est pas un tazpkg. Arrêt" +msgstr "$file n'est pas un tazpkg. Arrêt" #: rootfs/var/www/cgi-bin/cgi-env.sh:17 rootfs/var/www/cgi-bin/cgi-env.sh:24 msgid "CGI SHell Environment" @@ -96,6 +109,11 @@ msgid "Usage: man [section] command" msgstr "" +#: rootfs/usr/bin/man:43 +#, sh-format +msgid "in section $SECTION" +msgstr "" + #: rootfs/usr/bin/man:78 #, sh-format msgid "No manual entry for $TOPIC$MSG" diff -r 1c8307dbe719 -r d4df77afbed6 po/ru.po --- a/po/ru.po Sat Jun 02 18:05:40 2012 -0500 +++ b/po/ru.po Sun Jun 03 14:09:18 2012 +0000 @@ -7,8 +7,8 @@ msgstr "" "Project-Id-Version: SliTaz Base\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-05-21 11:30+0300\n" -"PO-Revision-Date: 2012-05-21 11:32+0300\n" +"POT-Creation-Date: 2012-06-03 14:03+0000\n" +"PO-Revision-Date: 2012-06-03 14:06-0000\n" "Last-Translator: Aleksej Bobylev \n" "Language-Team: \n" "Language: ru\n" @@ -19,38 +19,51 @@ "X-Poedit-Basepath: ../\n" "X-Poedit-SearchPath-0: .\n" -#: rootfs/lib/libtaz.sh:28 +#: rootfs/lib/libtaz.sh:25 msgid "Done" msgstr "Готово" -#: rootfs/lib/libtaz.sh:29 +#: rootfs/lib/libtaz.sh:26 msgid "Failed" msgstr "Ошибка" -#: rootfs/lib/libtaz.sh:132 +#: rootfs/lib/libtaz.sh:155 msgid "You must be root to execute:" msgstr "Вы должны обладать правами root для запуска:" -#: rootfs/lib/libtaz.sh:145 +#: rootfs/lib/libtaz.sh:168 msgid "y" msgstr "" -#: rootfs/lib/libtaz.sh:146 +#: rootfs/lib/libtaz.sh:169 msgid "Y" msgstr "" -#: rootfs/lib/libtaz.sh:147 +#: rootfs/lib/libtaz.sh:170 msgid "n" msgstr "" -#: rootfs/lib/libtaz.sh:148 +#: rootfs/lib/libtaz.sh:171 msgid "N" msgstr "" -#: rootfs/usr/lib/slitaz/libpkg.sh:32 +#: rootfs/usr/lib/slitaz/libpkg.sh:33 +msgid "Mirror is unreachable" +msgstr "Зеркало недоступно" + +#: rootfs/usr/lib/slitaz/libpkg.sh:37 +msgid "Mirror is up-to-date" +msgstr "Зеркало в актуальном состоянии" + +#: rootfs/usr/lib/slitaz/libpkg.sh:46 +#, sh-format +msgid "Missing receipt: $receipt" +msgstr "Отсутствует рецепт: $receipt" + +#: rootfs/usr/lib/slitaz/libpkg.sh:66 #, sh-format msgid "$file is not a tazpkg. Exiting" -msgstr "Файл $file не является пакетом. Выход" +msgstr "Файл $file не является пакетом tazpkg. Выход" #: rootfs/var/www/cgi-bin/cgi-env.sh:17 #: rootfs/var/www/cgi-bin/cgi-env.sh:24 @@ -95,6 +108,11 @@ msgid "Usage: man [section] command" msgstr "Использование: man [раздел] команда" +#: rootfs/usr/bin/man:43 +#, sh-format +msgid "in section $SECTION" +msgstr "в разделе $SECTION" + #: rootfs/usr/bin/man:78 #, sh-format msgid "No manual entry for $TOPIC$MSG" diff -r 1c8307dbe719 -r d4df77afbed6 po/slitaz-base.pot --- a/po/slitaz-base.pot Sat Jun 02 18:05:40 2012 -0500 +++ b/po/slitaz-base.pot Sun Jun 03 14:09:18 2012 +0000 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: SliTaz Base\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-05-21 11:30+0300\n" +"POT-Creation-Date: 2012-06-03 14:03+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,35 +17,48 @@ "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: rootfs/lib/libtaz.sh:28 +#: rootfs/lib/libtaz.sh:25 msgid "Done" msgstr "" -#: rootfs/lib/libtaz.sh:29 +#: rootfs/lib/libtaz.sh:26 msgid "Failed" msgstr "" -#: rootfs/lib/libtaz.sh:132 +#: rootfs/lib/libtaz.sh:155 msgid "You must be root to execute:" msgstr "" -#: rootfs/lib/libtaz.sh:145 +#: rootfs/lib/libtaz.sh:168 msgid "y" msgstr "" -#: rootfs/lib/libtaz.sh:146 +#: rootfs/lib/libtaz.sh:169 msgid "Y" msgstr "" -#: rootfs/lib/libtaz.sh:147 +#: rootfs/lib/libtaz.sh:170 msgid "n" msgstr "" -#: rootfs/lib/libtaz.sh:148 +#: rootfs/lib/libtaz.sh:171 msgid "N" msgstr "" -#: rootfs/usr/lib/slitaz/libpkg.sh:32 +#: rootfs/usr/lib/slitaz/libpkg.sh:33 +msgid "Mirror is unreachable" +msgstr "" + +#: rootfs/usr/lib/slitaz/libpkg.sh:37 +msgid "Mirror is up-to-date" +msgstr "" + +#: rootfs/usr/lib/slitaz/libpkg.sh:46 +#, sh-format +msgid "Missing receipt: $receipt" +msgstr "" + +#: rootfs/usr/lib/slitaz/libpkg.sh:66 #, sh-format msgid "$file is not a tazpkg. Exiting" msgstr "" @@ -96,6 +109,11 @@ msgid "Usage: man [section] command" msgstr "" +#: rootfs/usr/bin/man:43 +#, sh-format +msgid "in section $SECTION" +msgstr "" + #: rootfs/usr/bin/man:78 #, sh-format msgid "No manual entry for $TOPIC$MSG" diff -r 1c8307dbe719 -r d4df77afbed6 rootfs/lib/libtaz.sh --- a/rootfs/lib/libtaz.sh Sat Jun 02 18:05:40 2012 -0500 +++ b/rootfs/lib/libtaz.sh Sun Jun 03 14:09:18 2012 +0000 @@ -98,18 +98,7 @@ esac } -# Better to keep messages unsplitted -# Example: unboldify "My pretty function ;)" -unboldify() { - case $output in - raw) echo "$@" | sed -e 's|||g;s|||g' ;; - gtk) echo "$@" ;; - html) echo "$@" | sed -e 's|||g;s|||g' ;; - *) echo -e "$(echo "$@" | sed -e 's||\\033[1m|g;s||\\033[0m|g')" ;; - esac -} - -# Usage: colorize "Message" colorNB or use --color=NB option +# Usage: colorize colorNB "Message" or use --color=NB option # when running a tool. Default to white/38 and no html or gtk. colorize() { : ${color=$1} @@ -131,6 +120,35 @@ echo -e "\033["$in"G $@"; } +# Extended MeSsaGe output +emsg() { + local sep="\n--------\n" + case $output in + raw) + echo "$@" | sed -e 's|||g; s|||g; s|||g; \ + s|||g; s|<->|'$sep'|g; s||\n|g; s|| |g' ;; + gtk) + echo "$@" | sed -e 's|||g; s|||g; s|<->|'$sep'|g; \ + s||\n|g; s|| |g' ;; + html) + echo "$@" | sed -e 's|||g; s|||g; \ + s||
|g; s|<->|
|g; s|| |g' ;; + *) + local sep="\n" + local cols=$(get_cols) + [ "$cols" ] || cols=80 + for c in $(seq 1 $cols) + do + sep="${sep}=" + done + echo -en "$(echo "$@" | sed -e 's||\\033[1m|g; s||\\033[0m|g; \ + s||\\033[1;\1m|g; s||\\033[0;39m|g; s||\n|g; \ + s|<->|'$sep'|g; s||\\033[\1G|g')" + [ "$1" != "-n" ] && echo + ;; + esac +} + # Check if user is logged as root. check_root() { if [ $(id -u) != 0 ]; then @@ -141,7 +159,7 @@ # Display debug info when --debug is used. debug() { - [ "$debug" ] && echo "$(colorize $decolor "DEBUG:") $1" + [ "$debug" ] && echo "$(colorize $decolor 'DEBUG:') $1" } # Gettextize yes/no. diff -r 1c8307dbe719 -r d4df77afbed6 rootfs/usr/bin/man --- a/rootfs/usr/bin/man Sat Jun 02 18:05:40 2012 -0500 +++ b/rootfs/usr/bin/man Sun Jun 03 14:09:18 2012 +0000 @@ -27,7 +27,7 @@ ''|-*) cat <Usage: man [section] command')" +emsg "$(gettext 'Usage: man [section] command')" EOT return ;; @@ -40,7 +40,7 @@ if [ -n "$2" ]; then SECTION=$1 MAN_SECTION=$1 - MSG=" in section $SECTION" + MSG=" $(eval_gettext 'in section $SECTION')" shift fi @@ -58,7 +58,7 @@ return fi -for i in /usr/share/$LC_ALL/man$MAN_SECTION /usr/share/man$MAN_SECTION; do +for i in /usr/share/man/$LC_ALL/man$MAN_SECTION /usr/share/man/man$MAN_SECTION; do if [ -f $i/raw-$TOPIC.* ]; then i=$(ls $i/raw-$TOPIC.*) case "$i" in diff -r 1c8307dbe719 -r d4df77afbed6 rootfs/usr/lib/slitaz/libpkg.sh --- a/rootfs/usr/lib/slitaz/libpkg.sh Sat Jun 02 18:05:40 2012 -0500 +++ b/rootfs/usr/lib/slitaz/libpkg.sh Sun Jun 03 14:09:18 2012 +0000 @@ -43,7 +43,7 @@ source_receipt() { local receipt=$1 if [ ! -f $receipt ]; then - indent 28 $(gettext "Missing receipt: ") $receipt + indent 28 $(eval_gettext 'Missing receipt: $receipt') continue else . $receipt @@ -63,8 +63,7 @@ check_valid_tazpkg() { local file=$1 if ! is_valid_tazpkg $file; then - echo -n "$file " - gettext "is not a tazpkg. Exiting"; newline + eval_gettext "\$file is not a tazpkg. Exiting"; newline exit 1 fi } diff -r 1c8307dbe719 -r d4df77afbed6 testsuite.sh --- a/testsuite.sh Sat Jun 02 18:05:40 2012 -0500 +++ b/testsuite.sh Sun Jun 03 14:09:18 2012 +0000 @@ -13,9 +13,6 @@ echo -n "Checking libtaz.sh: boldify() " boldify "Message" - echo -n "Checking libtaz.sh: unboldify() " - unboldify "It's a sample message" - echo -n "Checking libtaz.sh: colorize() " echo -n $(colorize 33 "Message ") echo -n $(colorize 35 "Message ") @@ -23,6 +20,9 @@ echo "Checking libtaz.sh: separator" separator + + echo -n "Checking libtaz.sh: emsg() " + emsg "bold color: bold red bold green separator:<->newline: message withindent" } # Usage: check_functions path/to/lib.sh @@ -59,7 +59,7 @@ check_libtaz output="raw" -echo "Checking libtaz.sh: --output=raw" +echo -e "\nChecking libtaz.sh: --output=raw" check_libtaz # Check libtaz.sh functions usage