Package: euro-support
Severity: minor
Tags: patch l10n

Hi,

The current l10n infrastructure in euro-support gives bad results, the
main problem being that one sentence can be splitted into differents
strings, for example:
#at line 121
  msgid ""
  "Install the following packages: xfonts-base-transcoded, "
  "xfonts-100dpi-transcoded"
  msgstr ""
  #at line 122
  msgid "and xfonts-75dpi-transcoded"
  msgstr ""

The format of this file is also not convenient for translators.

The recommended workaround for the problem with shell scripts is to use
  gettext "foo bar"; echo
instead of
  gettext -s "foo bar"

Attached are two patches:
* euro-test.diff applies to euro-test and contains the following fixes:
  - preparation of the strings to be handled properly with xgettext
  - typo fixes: mainly s/an euro/a euro/ and some minor improvements
* Makefile.diff applies to po/Makefile and contains the following fixes:
  - uses wildcards instead of hardcoded list of po files (de.po exists
    but was not taken in account in your previous Makefile)
  - uses xgettext to generate the pot file
  - uses msgfmt to create the messages catalogs

Please also do not remove the .pot file from your source package, it
allows the l10n infrastructure to easily detect that your package has to
be translated, and ease the work of translators if they want to start a
new translation, as they only have to fetch the .pot file instead of
trying to understand how the package is built.
See http://www.debian.org/intl/l10n/po/pot for example.

Once these patches have been applied, you can remove
* po/create_mo
* po/extract-gettext-sh
* po/euro-support.1st

Cheers,

-- 
Thomas Huriaux
--- euro-test.orig      2006-02-28 17:08:16.000000000 +0100
+++ euro-test   2006-03-06 15:10:20.575268052 +0100
@@ -22,7 +22,7 @@
 }
 
 read_answer () {
-       gettext "Can you see an euro character in the previous line (y/N) "
+       gettext "Can you see a euro character in the previous line (y/N) "
        read sino
        case "$sino" in
        s*|S*|y*|Y*)    answer=1;;
@@ -33,18 +33,18 @@
        print_euro_iso8859_15
        read_answer
        [ $answer = 1 ] && { 
-               gettext -s "Your font has euro support (ISO8859-15)"
+               gettext "Your font has euro support (ISO8859-15)"; $ECHO
                eurofont="iso8859"
                return 0
        }
        print_euro_utf
        read_answer
        [ $answer = 1 ] && { 
-               gettext -s "Your font has euro support (UTF-8)"
+               gettext "Your font has euro support (UTF-8)"; $ECHO
                eurofont="utf"
                return 0
        }
-       gettext -s "Your font does not have euro support."
+       gettext "Your font does not have euro support."; $ECHO
        eurofont=""
        return 1
 }
@@ -60,17 +60,17 @@
        read test
        read_answer
        [ $answer = 1 ] && {
-               gettext -s "Your keyboard is euro-ready."
+               gettext "Your keyboard is euro-ready."; $ECHO
                eurokey=1
                return 0
        }
-       gettext -s "Your keyboard is not configured for euro support."
+       gettext "Your keyboard is not configured for euro support."; $ECHO
        eurokey=0
        return 1
 }
 
 set_console_euro_font () {
-       gettext -s "Installing a font with euro support"
+       gettext "Installing a font with euro support"; $ECHO
        if [ -f /usr/bin/consolechars ] 
        then
                /usr/bin/consolechars -f lat0-16 || {
@@ -84,60 +84,64 @@
        then
                /usr/bin/setfont -f lat0-1
        else
-               gettext -s "Cannot install a new font, consolechars or setfont 
program not found"
+               gettext "Cannot install a new font, consolechars or setfont 
program not found"; $ECHO
        fi
 }
 
 set_console_euro_key () {
-       gettext -s "Reconfiguring the keyboard"
+       gettext "Reconfiguring the keyboard"; $ECHO
        if [ -f /bin/loadkeys ] ; then
        loadkeys euro.inc.gz || {
-               gettext -s "Error while reconfiguring the keyboard"
+               gettext "Error while reconfiguring the keyboard"; $ECHO
                # TODO: This is only valid for these keymaps (not all european
                # languages)
                if [ ! -f /usr/share/keymaps/i386/include/euro.inc.gz ]
                then
-                       gettext -s "Your system does not have an euro 
definition installed"
+                       gettext "Your system does not have a euro definition 
installed"; $ECHO
                else
-                       gettext -s "Your euro definition is not correct or 
could not be installed"
+                       gettext "Your euro definition is not correct or could 
not be installed"; $ECHO
                fi
                set_console_euro_key
        }
        else
-               gettext -s "Cannot find loadkeys, it is not possible to 
reconfigure the keyboard"
+               gettext "Cannot find loadkeys, it is not possible to 
reconfigure the keyboard"; $ECHO
        fi
                
 }
 
 set_X_euro_font () {
-       gettext -s "Trying installed X fonts"
+       gettext "Trying installed X fonts"; $ECHO
        X_fonts=`xlsfonts | grep iso8859-15$`
        if [ ! -z "$X_fonts" ] 
                then
 # We could take the first font here and launch a new xterm with it
-               gettext -s "The following fonts with euro support are installed 
in your system:"
+               gettext "The following fonts with euro support are installed on 
your system:"; $ECHO
                $ECHO $X_fonts
                if [ "$ARG" = "X" ] 
                then
-                       gettext -s "It has not been possible to execute a 
terminal with an euro font (second try)."
+                       gettext "\
+It has not been possible to execute a terminal with a euro font
+(second try)."; $ECHO
                else
-                       gettext -s "This program will be executed again with a 
terminal that loads an euro font"
-                       gettext -s "(using 'x-terminal-emulator -fn 
\"name_of_font\")"
+                       gettext "\
+This program will be executed again with a terminal that loads a euro font
+(using 'x-terminal-emulator -fn \"name_of_font\")"; $ECHO
                        xfont=`$ECHO $X_fonts |  sed 's/\(-iso8859-15\) .*/\1/'`
                        x-terminal-emulator -fn "$xfont" -e $0 X
                fi 
                        exit 0
        else
-               gettext -s "There are no fonts with the euro character"
-               gettext -s "Install the following packages: 
xfonts-base-transcoded, xfonts-100dpi-transcoded"   
-               gettext -s "and xfonts-75dpi-transcoded"
+               gettext "\
+There are no fonts with the euro character.
+Install the following packages: xfonts-base-transcoded,
+xfonts-100dpi-transcoded and xfonts-75dpi-transcoded."; $ECHO
        fi
 }
 
 # Setting the euro key
 
 set_console_euro_key () {
-       gettext -s "Trying manual loading"
+       gettext "Trying manual loading"; $ECHO
 # TODO: get mapping for other languages
 #      [ ! -z "`locale |grep en_`" ] && keycode="keycode 13 = 4 dollar 
currency cent" 
 #      [ ! -z "`locale |grep lv_`" ] && keycode="keycode 13 = 4 dollar 
currency cent" 
@@ -154,7 +158,7 @@
 }
 
 set_X_euro_key () {
-       gettext -s "Reconfiguring the keyboard in X"
+       gettext "Reconfiguring the keyboard in X"; $ECHO
        keycode="keycode 26 = e E currency cent" 
        [ ! -z "`locale |grep en_`" ] && keycode="keycode 13 = 4 dollar 
currency cent" 
        [ ! -z "`locale |grep lv_`" ] && keycode="keycode 13 = 4 dollar 
currency cent" 
@@ -164,7 +168,7 @@
 # Not known:
        [ ! -z "`locale |grep gr_`" -o ! -z "`locale |grep hu_`" -o \
        ! -z "`locale |grep az_`" -o ! -z "`locale |grep lt_`"  ] && {
-               gettext  -s "euro-test cannot determine the mapping for your 
language..sorry"
+               gettext "euro-test cannot determine the mapping for your 
language"; $ECHO
                exit 1
        }
 
@@ -185,14 +189,14 @@
                xmodmap -e "$keycode"
                ;;
                *)
-               gettext -s "Cannot determine Xfree version properly"
+               gettext "Cannot determine Xfree version properly"; $ECHO
                exit 1
                ;;
        esac
 }
 
 test_euro_console () {
-       gettext -s "Trying text environment (console)"
+       gettext "Trying text environment (console)"; $ECHO
        test_euro_font || set_font=1
        [ $set_font = 1 ] && { 
                set_console_euro_font 
@@ -206,29 +210,29 @@
 # TODO: Is this necessary? (restore the console font)
        [ $set_font = 1 ] && {
 # Might need superuser priviledges
-               gettext -s "Restoring the console font (if it does not work run 
the commands as root):"
-               gettext -s "Running /etc/init.d/keymaps-lct.sh reload..."
+               gettext "Restoring the console font (if it does not work run 
the commands as root):"; $ECHO
+               gettext "Running /etc/init.d/keymaps-lct.sh reload..."; $ECHO
                /etc/init.d/keymaps-lct.sh reload
-               gettext -s "...done"
-               gettext -s "Running /etc/init.d/console-screen.sh reload..."
+               gettext "...done."; $ECHO
+               gettext "Running /etc/init.d/console-screen.sh reload..."; $ECHO
                /etc/init.d/console-screen.sh reload
-               gettext -s "...done"
+               gettext "...done."; $ECHO
        }
        if [ ! -z "$eurofont" -a $eurokey = 1 -a $set_font = 0 -a $set_key = 0 
] 
        then
-               gettext -s "Congratulations! Your system is prepared to 
represent the euro char (in console)"
+               gettext "Congratulations! Your system is ready to display the 
euro char (in console)"; $ECHO
        else
-               gettext -s "In order to represent euros in your system you will 
need to:"
-               [ $set_font = 1  -a -z "$eurofont" ] && gettext -es "\tInstall 
a console font with the euro char."
-               [ $set_font = 1 -a ! -z "$eurofont" ] && gettext -es "\tSet as 
your console font one with euro support."
-               [ $set_key = 1 -a $eurokey = 1 ] && gettext -es "\tConfigure 
your keyboard so that it generates the euro symbol."
-               [ $set_key = 1 -a $eurokey = 0 ] && gettext -es "\tInstall 
support to your keyboard to generate the euro combination."
-               gettext -s "Please read the \"Debian Euro Manual\" to see how 
to properly configure this"
+               gettext "In order to display the euro char on your system you 
will need to:"; echo
+               [ $set_font = 1  -a -z "$eurofont" ] && gettext "* Install a 
console font with the euro char."; $ECHO
+               [ $set_font = 1 -a ! -z "$eurofont" ] && gettext "* Set as your 
console font one with euro support."; $ECHO
+               [ $set_key = 1 -a $eurokey = 1 ] && gettext "* Configure your 
keyboard so that it generates the euro symbol."; $ECHO
+               [ $set_key = 1 -a $eurokey = 0 ] && gettext "* Install support 
to your keyboard to generate the euro combination."; $ECHO
+               gettext "Please read the \"Debian Euro Manual\" to see how to 
properly configure this"; $ECHO
        fi
 }
 
 test_euro_X () {
-       gettext -s "Trying graphic environment (X)"
+       gettext "Trying graphic environment (X)"; $ECHO
        test_euro_font || set_font=1
        [ $set_font = 1 ] && { 
                set_X_euro_font 
@@ -241,34 +245,34 @@
        }
        if [ ! -z "$eurofont" -a $eurokey = 1 -a $set_font = 0 -a $set_key = 0 
] 
        then
-               gettext -s "Congratulations! Your system is prepared to 
represent the euro char (in X)"
+               gettext "Congratulations! Your system is ready to display the 
euro char (in X)"; $ECHO
        else
-               gettext -s "In order to represent euros in your X system you 
will need to:"
-               [ $set_font = 1  -a -z "$eurofont" ] && gettext -es "\tInstall 
an X font with the euro char."
-               [ $set_font = 1 -a ! -z "$eurofont" ] && gettext -es "\tSet as 
your terminal/programs font one with euro support."
-               [ $set_key = 1 -a $eurokey = 1 ] && gettext -es "\tConfigure 
your keyboard in X so that it generates the euro symbol."
-               [ $set_key = 1 -a $eurokey = 0 ] && gettext -es "\tInstall 
support to your keyboard in X to generate the euro combination."
-               gettext -s "Please read the \"Debian Euro Manual\" to see how 
to properly configure this."
+               gettext "In order to display the euro char on your X system you 
will need to:"; $ECHO
+               [ $set_font = 1  -a -z "$eurofont" ] && gettext "* Install an X 
font with the euro char."; $ECHO
+               [ $set_font = 1 -a ! -z "$eurofont" ] && gettext "* Set as your 
terminal/programs font one with euro support."; $ECHO
+               [ $set_key = 1 -a $eurokey = 1 ] && gettext "* Configure your 
keyboard in X so that it generates the euro symbol."; $ECHO
+               [ $set_key = 1 -a $eurokey = 0 ] && gettext "* Install support 
to your keyboard in X to generate the euro combination."; $ECHO
+               gettext "Please read the \"Debian Euro Manual\" to see how to 
properly configure this."
        fi
 # TODO: Add info on X packages with euro keys
        if [ "$ARG" = "X" ] ; then
-               gettext -s "Press <ENTER> to close this terminal"
+               gettext "Press <ENTER> to close this terminal"; $ECHO
                read a
        fi
 }
 
 info_system () {
 
-       gettext -s "System information, please send to [EMAIL PROTECTED]"
+       gettext "System information, please send to [EMAIL PROTECTED]"; $ECHO
        if [ -f /etc/debian_version ]
                then
                version=`cat /etc/debian_version`
-               gettext -es "Debian GNU/Linux Version: $version"
+               gettext "Debian GNU/Linux Version: $version"; $ECHO
        fi
        case $1 in
        "console" )
-               gettext -s "The test is running under console."
-               gettext -s "Information of console-related packages, can take 
some seconds:"
+               gettext "The test is running under console."; $ECHO
+               gettext "Information of console-related packages, can take some 
seconds:"; $ECHO
                dpkg -l kbd |grep ^i 
                dpkg -l console-tools |grep ^i 
                dpkg -l console-data |grep ^i 
@@ -290,8 +294,8 @@
                fi 
                ;;
        "X" )
-               gettext -s "The test is running under X graphic environment."
-               gettext -s "Information of X-related packages, can take some 
seconds:"
+               gettext "The test is running under X graphic environment."; 
$ECHO
+               gettext "Information of X-related packages, can take some 
seconds:"; $ECHO
                dpkg -l xfree* |grep ^i
                dpkg -l xbase* |grep ^i
                dpkg -l xfonts* |grep ^i
@@ -327,8 +331,8 @@
 
 if [ ! -f $DPKG ]
 then   
-       gettext -s "WARN: This system is not a Debian GNU/Linux system"
-       gettext -s "WARN: This program might not work correctly"
+       gettext "WARN: This system is not a Debian GNU/Linux system"; $ECHO
+       gettext "WARN: This program might not work correctly"; $ECHO
 fi
 
 if [ -z "$DISPLAY" ] 
@@ -338,8 +342,10 @@
        test_euro_X
 fi
 
-gettext -s "NOTE: More information regarding euro support is available at"
-gettext -s "/usr/share/doc/euro-support/ or through the 
doc-base/dwww/doc-central interface"
+gettext "\
+NOTE: More information regarding euro support is available at
+/usr/share/doc/euro-support/ or through the doc-base/dwww/doc-central
+interface"; $ECHO
 
 if [ -f $DPKG ]
 then
@@ -347,8 +353,8 @@
        read sino
        case "$sino" in
        s*|S*|y*|Y*)    
-               gettext -s "The result generation can take some seconds."
-               gettext "Starting result generation...."
+               gettext "The result generation can take some seconds."; $ECHO
+               gettext "Starting result generation..."
                date=`date`
                $ECHO "Results generated on $date" >>$OUTFILE
                if [ ! -z "$eurofont" -a $eurokey = 1 -a $set_font = 0 -a 
$set_key = 0 ] 
@@ -369,11 +375,12 @@
                else
                        info_system X >>$OUTFILE
                fi
-               gettext -s "...finished."
-               gettext -s "Please send the output file $OUTFILE to the e-mail 
address:"
-               $ECHO "[EMAIL PROTECTED]"
-               gettext -s "your system information will be used in order to 
provide an automatic mechanism"
-               gettext -s "for euro support."
+               gettext "...done."; $ECHO
+               gettext "\
+Please send the output file $OUTFILE to the e-mail address:
+  [EMAIL PROTECTED]
+Your system information will be used in order to provide an automatic mechanism
+for euro support."; $ECHO
                ;;
        *)      ;;
        esac
--- Makefile.orig       2006-02-28 17:08:16.000000000 +0100
+++ Makefile    2006-02-28 17:08:15.000000000 +0100
@@ -1,24 +1,32 @@
 
 DOMAIN=euro-support
-all: $(DOMAIN).pot es.mo
 
-es.mo: $(DOMAIN).pot es.po
-       ./create_mo es
+POFILES=$(wildcard *.po)
+MOFILES=$(patsubst %.po,%.mo,$(POFILES))
 
-# Since xgettext currently does not work correctly with shell files...
-#$(DOMAIN).pot:
-#      xgettext --add-comments --force --default-domain=$(DOMAIN) \
-#              --output=$(DOMAIN).pot --files-from=POTFILES -C
-#      for file in `cat POTFILES`; do ./extract-gettext-sh $$file 
>>$(DOMAIN).pot; done
-# I made it by hand with help of scripts:
-$(DOMAIN).pot: $(DOMAIN).1st
-       cp $(DOMAIN).1st $(DOMAIN).pot
-
-install: es.mo
-       - install -d $(DESTDIR)/usr/share/locale/es/LC_MESSAGES/
-       - install -m 644 es.mo 
$(DESTDIR)/usr/share/locale/es/LC_MESSAGES/$(DOMAIN).mo
-
-clean:
-       - rm *.pot
-       - rm *.pox
-       - rm *.mo
+all: $(MOFILES)
+
+%.mo: $(DOMAIN).pot %.po
+       msgfmt -o $@ $*.po
+
+$(DOMAIN).pot: ../euro-test
+       xgettext --default-domain=$(DOMAIN) \
+         --files-from=POTFILES -L Shell -o $(DOMAIN).pot
+
+update-po: $(DOMAIN.pot)
+       for po in $(POFILES); do \
+         msgmerge -U $$po $(DOMAIN).pot; \
+       done;
+
+install: $(MOFILES)
+       -for lang in $(patsubst %.mo, %, $(MOFILES)); do \
+         install -d $(DESTDIR)/usr/share/locale/$$lang/LC_MESSAGES/; \
+         install -m 644 $$lang.mo \
+           $(DESTDIR)/usr/share/locale/$$lang/LC_MESSAGES/$(DOMAIN).mo; \
+       done;
+
+clean: update-po
+       - rm -f *.mo
+       - rm -f *~
+
+.PHONY: update-po

Attachment: signature.asc
Description: Digital signature

Reply via email to