# HG changeset patch # User Aleksej Bobylev # Date 1337583987 -10800 # Node ID efb8e0291f24d6bcfac55fde2bcf6c82915a898f # Parent c09b461ada93a319998ae6b00c83a6d70308eaf3 libtaz.sh, Makefile: fix design of i18n diff -r c09b461ada93 -r efb8e0291f24 Makefile --- a/Makefile Sat May 19 03:57:26 2012 -0500 +++ b/Makefile Mon May 21 10:06:27 2012 +0300 @@ -14,7 +14,14 @@ pot: xgettext -o po/$(PACKAGE).pot -L Shell --package-name="SliTaz Base" \ - ./rootfs/lib/libtaz.sh ./rootfs/usr/lib/slitaz/libpkg.sh + --copyright-holder="SliTaz Association" -k -klgettext \ + ./rootfs/lib/libtaz.sh + xgettext -j -o po/$(PACKAGE).pot -L Shell --package-name="SliTaz Base" \ + --copyright-holder="SliTaz Association" \ + ./rootfs/usr/lib/slitaz/libpkg.sh \ + ./rootfs/var/www/cgi-bin/cgi-env.sh \ + ./rootfs/var/www/cgi-bin/index.cgi \ + ./rootfs/usr/bin/man msgmerge: @for l in $(LINGUAS); do \ diff -r c09b461ada93 -r efb8e0291f24 rootfs/lib/libtaz.sh --- a/rootfs/lib/libtaz.sh Sat May 19 03:57:26 2012 -0500 +++ b/rootfs/lib/libtaz.sh Mon May 21 10:06:27 2012 +0300 @@ -12,12 +12,21 @@ # Internationalization. . /usr/bin/gettext.sh -TEXTDOMAIN='slitaz-base' -export TEXTDOMAIN +# We can't export TEXTDOMAIN because this script includes to other scripts +# with other TEXTDOMAIN exported +## TEXTDOMAIN='slitaz-base' +## export TEXTDOMAIN + +# xgettext (from Makefile) can't extract strings from above example: +# gettext -d 'slitaz-base' 'Done' +# so, I define own function (and add it as option to xgettext to Makefile) +lgettext() { + gettext -d 'slitaz-base' $1 +} # Internal variables. -okmsg="$(gettext "Done")" -ermsg="$(gettext "Failed")" +okmsg="$(lgettext 'Done')" +ermsg="$(lgettext 'Failed')" : ${okcolor=32} : ${ercolor=31} : ${decolor=36} @@ -109,7 +118,7 @@ # Check if user is logged as root. check_root() { if [ $(id -u) != 0 ]; then - gettext "You must be root to execute:" && echo " $(basename $0) $@" + lgettext "You must be root to execute:" && echo " $(basename $0) $@" exit 1 fi } @@ -122,10 +131,10 @@ # Gettextize yes/no. translate_query() { case $1 in - y) gettext "y" ;; - Y) gettext "Y" ;; - n) gettext "n" ;; - N) gettext "N" ;; + y) lgettext "y" ;; + Y) lgettext "Y" ;; + n) lgettext "n" ;; + N) lgettext "N" ;; # Support other cases but keep them untranslated. *) echo "$1" ;; esac