On Mon, Jan 12, 2004 at 09:33:24AM -0500, Joey Hess wrote: > Denis Barbier wrote: > > Then "xgettext -L Shell apt-setup" prints in the PO file: > > I didn't known of -L Shell or it did not exist when I originally > internationalised base-config. I would like to see it use #!/bin/sh and > gettext throughout. AFAIK, there are no bashisms aside from $"".
Here is a patch, tested with French language. I forgot several points in my previous message: * $"..." cannot handle plural forms, so calls to gettext is the only option. * The shell string extractor has been introduced in gettext 0.13 * gettext 0.13 should hit testing in few days. This version is only needed to build .pot files, so these files could be shipped in the tarball if depending on a new version is harmful. * The whole sentence has been passed to ngettext, to make sure that no language is excluded. /bin/bash has not been replaced by /bin/sh, it should be done too. Please let me know if I can commit this patch or you prefer waiting for gettext 0.13 entering testing. Denis
Index: apt-setup =================================================================== RCS file: /cvsroot/base-config/base-config/apt-setup,v retrieving revision 1.38 diff -u -r1.38 apt-setup --- apt-setup 11 Jan 2004 15:01:03 -0000 1.38 +++ apt-setup 12 Jan 2004 23:08:03 -0000 @@ -34,7 +34,7 @@ # Pass in a URI type; this function returns a list of countries # that have mirrors in them that match the type. country_list () { - printf $"enter information manually, " + gettext "enter information manually, " perl -ne ' BEGIN { $type=shift; @@ -109,7 +109,8 @@ # The cd will then be unmounted. scan_cd () { clear >/dev/tty </dev/tty - echo $"Scanning CD, this will take a minute." + gettext "Scanning CD, this will take a minute." + echo # Touch file because apt-cdrom bails if it doesn't exist. touch ${APTETC}sources.list if $APTCDROM add --no-mount </dev/tty >/dev/tty; then @@ -174,13 +175,13 @@ db_set apt-setup/another true fi - db_subst apt-setup/another PACKAGE_COUNT $PACKAGE_COUNT - db_subst apt-setup/another PACKAGES \ - "$(ngettext package packages $PACKAGE_COUNT)" - # This is only here to make the "package" and "packages" msgids - # used in the ngettext above go into the po files. - foo=$"package" - foo=$"packages" + # Several notes for translators: + # * The singular form is only there to make use of plural forms; + # * If package count is 0, a separate error message should be displayed. + # * This sentence is part of a longer paragraph, full stop is omitted here. + # * "${PACKAGE_COUNT}" must not be translated. + MESSAGE=$(ngettext 'The Debian package management tool, apt, is now configured, and can install any of ${PACKAGE_COUNT} package' 'The Debian package management tool, apt, is now configured, and can install any of ${PACKAGE_COUNT} packages' $PACKAGE_COUNT | sed -e "s/\${PACKAGE_COUNT}/$PACKAGE_COUNT/") + db_subst apt-setup/another MESSAGE $MESSAGE db_fset apt-setup/another seen false db_input $prio apt-setup/another || return 1 @@ -220,7 +221,7 @@ # is the default, and just go on to ask them where they want # apt to install from. db_set apt-setup/uri_type "cdrom" - db_subst apt-setup/uri_type note $"You probably used a CD to install the Debian base system, but it is not currently in the drive. You should probably just insert it and select \"cdrom\"." + db_subst apt-setup/uri_type note $(gettext 'You probably used a CD to install the Debian base system, but it is not currently in the drive. You should probably just insert it and select "cdrom".') fi fi @@ -269,7 +270,7 @@ db_go || continue db_get apt-setup/country - if [ "$RET" != $"enter information manually" ]; then + if [ "$RET" != "$(gettext 'enter information manually')" ]; then # Now prompt with the mirrors in the selected country. db_subst apt-setup/mirror mirrors "`mirror_list $URI \"$RET\"`" db_fset apt-setup/mirror seen false @@ -397,7 +398,8 @@ $EDITOR ${APTETC}sources.list >/dev/tty </dev/tty tempfile=`tempfile` clear >/dev/tty </dev/tty - echo $"Testing apt sources ..." + gettext "Testing apt sources ..." + echo if $APTGET -o APT::Get::List-Cleanup=false -o Dir::Etc::sourcelist=${APTETC}sources.list update 2>$tempfile; then clear >/dev/tty </dev/tty EDITOK=1 @@ -466,7 +468,8 @@ # return code and errors. tempfile=`tempfile` clear >/dev/tty </dev/tty - echo $"Testing apt sources ..." + gettext "Testing apt sources ..." + echo if ! $APTGET $PROXY_OPTS -o APT::Get::List-Cleanup=false -o Dir::Etc::sourcelist=$tmpsources update 2>$tempfile; then clear >/dev/tty </dev/tty # Show the user the error message and loop. @@ -540,7 +543,8 @@ tmpsources=`tempfile` echo "deb $LINE" > $tmpsources clear >/dev/tty </dev/tty - echo $"Testing apt sources ..." + gettext "Testing apt sources ..." + echo tempfile=`tempfile` if ! $APTGET -o APT::Get::List-Cleanup=false -o Dir::Etc::sourcelist=$tmpsources update 2>$tempfile; then # Display failure message Index: apt-setup.templates =================================================================== RCS file: /cvsroot/base-config/base-config/apt-setup.templates,v retrieving revision 1.39 diff -u -r1.39 apt-setup.templates --- apt-setup.templates 11 Jan 2004 15:01:03 -0000 1.39 +++ apt-setup.templates 12 Jan 2004 23:08:03 -0000 @@ -131,10 +131,8 @@ Template: apt-setup/another Type: boolean _Description: Add another apt source? - The Debian package management tool, apt, is now configured, and can - install any of ${PACKAGE_COUNT} ${PACKAGES}. However, you may want to - add another source to apt, so it can download packages from more than one - location. + ${MESSAGE}. However, you may want to add another source to apt, so it can + download packages from more than one location. Template: apt-setup/badedit Type: select Index: base-config =================================================================== RCS file: /cvsroot/base-config/base-config/base-config,v retrieving revision 1.15 diff -u -r1.15 base-config --- base-config 11 Jan 2004 22:56:28 -0000 1.15 +++ base-config 12 Jan 2004 23:08:03 -0000 @@ -27,7 +27,8 @@ SHELL=/bin/sh export SHELL -echo $"Configuring the base system..." +gettext "Configuring the base system..." +echo cleanup () { cd / Index: debian/po/fr.po =================================================================== RCS file: /cvsroot/base-config/base-config/debian/po/fr.po,v retrieving revision 1.25 diff -u -r1.25 fr.po --- debian/po/fr.po 11 Jan 2004 17:38:55 -0000 1.25 +++ debian/po/fr.po 12 Jan 2004 23:08:08 -0000 @@ -10,8 +10,8 @@ msgstr "" "Project-Id-Version: base-config 1.70\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2004-01-11 10:03-0500\n" -"PO-Revision-Date: 2003-12-09 08:46+0100\n" +"POT-Creation-Date: 2004-01-12 23:22+0200\n" +"PO-Revision-Date: 2004-01-12 23:48+0200\n" "Last-Translator: Christian Perrier <[EMAIL PROTECTED]>\n" "Language-Team: French <[EMAIL PROTECTED]>\n" "MIME-Version: 1.0\n" @@ -756,15 +754,11 @@ #. Description #: ../../apt-setup.templates:133 msgid "" -"The Debian package management tool, apt, is now configured, and can install " -"any of ${PACKAGE_COUNT} ${PACKAGES}. However, you may want to add another " -"source to apt, so it can download packages from more than one location." -msgstr "" -"L'outil de gestion des paquets Debian, apt, est maintenant configuré et " -"peut installer tout paquet Debian parmi " -"${PACKAGE_COUNT} disponibles. Cependant, vous avec la possibilité d'ajouter une " -"autre source pour qu'apt puisse télécharger des logiciels depuis plusieurs " -"sites." +"${MESSAGE}. However, you may want to add another source to apt, so it can " +"download packages from more than one location." +msgstr "" +"${MESSAGE}. Cependant, vous avez la possibilité d'ajouter une autre source " +"pour qu'apt puisse télécharger des logiciels depuis plusieurs sites." #. Type: select #. Choices Index: debian/po/templates.pot =================================================================== RCS file: /cvsroot/base-config/base-config/debian/po/templates.pot,v retrieving revision 1.14 diff -u -r1.14 templates.pot --- debian/po/templates.pot 12 Jan 2004 13:10:45 -0000 1.14 +++ debian/po/templates.pot 12 Jan 2004 23:08:15 -0000 @@ -16,7 +16,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2004-01-12 14:09+0100\n" +"POT-Creation-Date: 2004-01-12 23:22+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <[EMAIL PROTECTED]>\n" "Language-Team: LANGUAGE <[EMAIL PROTECTED]>\n" @@ -657,9 +657,8 @@ #. Description #: ../../apt-setup.templates:133 msgid "" -"The Debian package management tool, apt, is now configured, and can install " -"any of ${PACKAGE_COUNT} ${PACKAGES}. However, you may want to add another " -"source to apt, so it can download packages from more than one location." +"${MESSAGE}. However, you may want to add another source to apt, so it can " +"download packages from more than one location." msgstr "" #. Type: select Index: lib/menu/pkgsel =================================================================== RCS file: /cvsroot/base-config/base-config/lib/menu/pkgsel,v retrieving revision 1.1 diff -u -r1.1 pkgsel --- lib/menu/pkgsel 8 Dec 2003 23:17:14 -0000 1.1 +++ lib/menu/pkgsel 12 Jan 2004 23:08:15 -0000 @@ -19,20 +19,20 @@ if which $program >/dev/null 2>&1; then case "$program" in dselect) - entry=$"dselect - old package selector (experts only)" + entry=`gettext "dselect - old package selector (experts only)"` ;; aptitude) - entry=$"aptitude - pick tasks or drill down to individual packages" + entry=`gettext "aptitude - pick tasks or drill down to individual packages"` ;; tasksel) - entry=$"tasksel - quickly choose from predefined collections of software" + entry=`gettext "tasksel - quickly choose from predefined collections of software"` ;; esac choices="$entry, $choices" db_set base-config/pkgsel "$entry" fi done - choices="$choices "$"nothing - you may manually run apt-get or any of the above later" + choices="$choices "`gettext "nothing - you may manually run apt-get or any of the above later"` db_subst base-config/pkgsel choices $choices db_fset base-config/pkgsel seen false db_input high base-config/pkgsel || true Index: po/Makefile =================================================================== RCS file: /cvsroot/base-config/base-config/po/Makefile,v retrieving revision 1.5 diff -u -r1.5 Makefile --- po/Makefile 23 Dec 2003 00:04:06 -0000 1.5 +++ po/Makefile 12 Jan 2004 23:08:15 -0000 @@ -23,9 +23,9 @@ for file in `find .. -perm +1 -type f` ; do \ bn=`basename $$file`; \ if head -n 1 $$file | grep -q bash ; then \ - bash --dump-po-strings $$file | msguniq - -o tmp.$$bn.pot; \ + xgettext -c -L Shell -o tmp.$$bn.pot $$file; \ else if head -n 1 $$file | grep -q perl ; then \ - xgettext -L C $$file -o tmp.$$bn.pot; \ + xgettext -c -L C -o tmp.$$bn.pot $$file; \ fi fi \ done msgcat tmp.*.pot > base-config.pot Index: po/fr.po =================================================================== RCS file: /cvsroot/base-config/base-config/po/fr.po,v retrieving revision 1.14 diff -u -r1.14 fr.po --- po/fr.po 11 Jan 2004 17:38:55 -0000 1.14 +++ po/fr.po 12 Jan 2004 23:08:16 -0000 @@ -5,12 +5,15 @@ msgid "" msgstr "" "Project-Id-Version: base-config 1.51\n" -"PO-Revision-Date: 2003-02-03 10:10+0100\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2004-01-12 23:55+0200\n" +"PO-Revision-Date: 2004-01-13 00:29+0200\n" "Last-Translator: Martin Quinson <[EMAIL PROTECTED]>\n" "Language-Team: french <[EMAIL PROTECTED]>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-1\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" #: ../apt-setup:37 msgid "enter information manually, " @@ -20,29 +22,37 @@ msgid "Scanning CD, this will take a minute." msgstr "Étude du cédérom, cela prend une minute." -#: ../apt-setup:182 -msgid "package" -msgstr "paquet" - +#. Several notes for translators: +#. * The singular form is only there to make use of plural forms; +#. * If package count is 0, a separate error message should be displayed. +#. * This sentence is part of a longer paragraph, full stop is omitted here. +#. * "${PACKAGE_COUNT}" must not be translated. #: ../apt-setup:183 -msgid "packages" -msgstr "paquets" +#, sh-format +msgid "" +"The Debian package management tool, apt, is now configured, and can install " +"any of ${PACKAGE_COUNT} package" +msgid_plural "" +"The Debian package management tool, apt, is now configured, and can install " +"any of ${PACKAGE_COUNT} packages" +msgstr[0] "" +"L'outil de gestion des paquets Debian, apt, est maintenant configuré et peut " +"installer tout paquet Debian parmi ${PACKAGE_COUNT} disponibles" +msgstr[1] "" +"L'outil de gestion des paquets Debian, apt, est maintenant configuré et peut " +"installer tout paquet Debian parmi ${PACKAGE_COUNT} disponibles" -#: ../apt-setup:223 +#: ../apt-setup:224 msgid "" "You probably used a CD to install the Debian base system, but it is not " -"currently in the drive. You should probably just insert it and select \\" -"\"cdrom\\\"." +"currently in the drive. You should probably just insert it and select \"cdrom" +"\"." msgstr "" "Vous avez probablement utilisé un cédérom pour installer le système de base " "de Debian, mais il n'est pas dans le lecteur. Vous devriez sans doute " "l'insérer et choisir « cédérom »." -#: ../apt-setup:272 -msgid "enter information manually" -msgstr "indiquez manuellement les informations" - -#: ../apt-setup:400 ../apt-setup:469 ../apt-setup:543 +#: ../apt-setup:401 ../apt-setup:471 ../apt-setup:546 msgid "Testing apt sources ..." msgstr "Vérification des sources apt..."