program maintainers.
xgettext, accordingly, has a new option --msgid-bugs-address.
-* xgettext now also supports Smalltalk and PHP.
+* Programming languages support:
-* A new C++ class, called gnu::autosprintf, makes it possible to use C format
- strings in C++. This is needed for proper internationalization of C++
- programs.
+ - C++
+
+ A new C++ class, called gnu::autosprintf, makes it possible to use
+ C format strings in C++. This is needed for proper internationalization
+ of C++ programs.
+
+ - Smalltalk
+
+ xgettext now also supports Smalltalk.
+
+ - PHP
+
+ xgettext now also supports PHP.
+
+ - Python
+
+ "xgettext --language=Python" now supports the plural handling functions
+ ngettext, dngettext, ungettext (introduced in Python 2.3).
* A new include file libgettextpo, with public header file "gettext-po.h",
provides functions for reading PO files into memory. It is useful for
xgettext has a new option --from-code that specifies the encoding of the
source files. The resulting POT files are UTF-8 encoded.
-* msgmerge has a new option -N/--no-fuzzy-matching that inhibits the fuzzy
- search for untranslated messages.
+* Tools for translators:
+
+ - msgmerge has a new option -N/--no-fuzzy-matching that inhibits the fuzzy
+ search for untranslated messages.
-* msgattrib has new options --only-file and --ignore-file that cause the
- specified attribute manipulation to apply to selected messages only.
+ - msgattrib has new options --only-file and --ignore-file that cause the
+ specified attribute manipulation to apply to selected messages only.
* Compatibility with automake-1.7.
+2003-02-22 Bruno Haible <bruno@clisp.org>
+
+ * gettext.texi (Python): Mention ngettext.
+
2003-02-22 Bruno Haible <bruno@clisp.org>
* Makefile.am (MOSTLYCLEANFILES): No need to clean the unused indices.
@code{_('abc')} etc.
@item gettext/ngettext functions
-@code{gettext.gettext}, @code{gettext.dgettext}, also @code{ugettext}
+@code{gettext.gettext}, @code{gettext.dgettext},
+@code{gettext.ngettext}, @code{gettext.dngettext},
+also @code{ugettext}, @code{ungettext}
@item textdomain
@code{gettext.textdomain} function, or
+2003-02-22 Bruno Haible <bruno@clisp.org>
+
+ * x-python.c (init_keywords): Add u*gettext variants and plural
+ handling functions added in Python 2.3.
+
2003-02-22 Bruno Haible <bruno@clisp.org>
* Makefile.am (installdirs): Remove dependency, redundant with
/* xgettext Python backend.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003 Free Software Foundation, Inc.
This file was written by Bruno Haible <haible@clisp.cons.org>, 2002.
if (default_keywords)
{
x_python_keyword ("gettext");
+ x_python_keyword ("ugettext");
x_python_keyword ("dgettext:2");
+ x_python_keyword ("ngettext:1,2");
+ x_python_keyword ("ungettext:1,2");
+ x_python_keyword ("dngettext:2,3");
x_python_keyword ("_");
default_keywords = false;
}
+2003-02-22 Bruno Haible <bruno@clisp.org>
+
+ * lang-python-1: Renamed from lang-python. Make it work with Python
+ 2.3.
+ * lang-python-2: New file.
+ * Makefile.am (TESTS): Remove lang-python, add lang-python-[12].
+
2003-02-20 Bruno Haible <bruno@clisp.org>
* msgfilter-1: Remove SKIP: messages, now emitted by the Makefile.
format-tcl-1 format-tcl-2 \
format-ycp-1 format-ycp-2 \
plural-1 plural-2 \
- lang-c lang-c++ lang-objc lang-python lang-clisp \
+ lang-c lang-c++ lang-objc lang-python-1 lang-python-2 lang-clisp \
lang-elisp lang-librep lang-smalltalk lang-java lang-gawk lang-pascal \
lang-ycp lang-tcl lang-php lang-po \
lang-rst
--- /dev/null
+#! /bin/sh
+
+# Test of gettext facilities (including plural handling) in the Python
+# language.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles prog.py"
+cat <<\EOF > prog.py
+import sys
+import gettext
+
+n = int(sys.argv[1])
+
+gettext.textdomain('prog')
+gettext.bindtextdomain('prog', '.')
+
+print gettext.gettext("'Your command, please?', asked the waiter.")
+print gettext.ngettext("a piece of cake","%(count)d pieces of cake",n) \
+ % { 'count': n }
+print gettext.gettext("%(oldCurrency)s is replaced by %(newCurrency)s.") \
+ % { 'oldCurrency': "FF", 'newCurrency' : "EUR" }
+EOF
+
+tmpfiles="$tmpfiles prog.pot"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} -o prog.pot --omit-header --no-location prog.py
+
+tmpfiles="$tmpfiles prog.ok"
+cat <<EOF > prog.ok
+msgid "'Your command, please?', asked the waiter."
+msgstr ""
+
+#, python-format
+msgid "a piece of cake"
+msgid_plural "%(count)d pieces of cake"
+msgstr[0] ""
+msgstr[1] ""
+
+#, python-format
+msgid "%(oldCurrency)s is replaced by %(newCurrency)s."
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} prog.ok prog.pot || exit 1
+
+tmpfiles="$tmpfiles fr.po"
+cat <<\EOF > fr.po
+msgid ""
+msgstr ""
+"Content-Type: text/plain; charset=ISO-8859-1\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+msgid "'Your command, please?', asked the waiter."
+msgstr "«Votre commande, s'il vous plait», dit le garçon."
+
+# Les gateaux allemands sont les meilleurs du monde.
+#, python-format
+msgid "a piece of cake"
+msgid_plural "%(count)d pieces of cake"
+msgstr[0] "un morceau de gateau"
+msgstr[1] "%(count)d morceaux de gateau"
+
+# Reverse the arguments.
+#, python-format
+msgid "%(oldCurrency)s is replaced by %(newCurrency)s."
+msgstr "%(newCurrency)s remplace %(oldCurrency)s."
+EOF
+
+tmpfiles="$tmpfiles fr.po.new"
+: ${MSGMERGE=msgmerge}
+${MSGMERGE} -q -o fr.po.new fr.po prog.pot
+
+: ${DIFF=diff}
+${DIFF} fr.po fr.po.new || exit 1
+
+tmpfiles="$tmpfiles fr"
+test -d fr || mkdir fr
+test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES
+
+: ${MSGFMT=msgfmt}
+${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po
+
+# Test for presence of python version 2.3 or newer.
+(python -V) >/dev/null 2>/dev/null \
+ || { rm -fr $tmpfiles; exit 77; }
+case `python -c 'import sys; print sys.hexversion >= 0x20300F0'` in
+ 1 | True) ;;
+ *) rm -fr $tmpfiles; exit 77;;
+esac
+
+tmpfiles="$tmpfiles prog.ok prog.out"
+: ${DIFF=diff}
+cat <<\EOF > prog.ok
+«Votre commande, s'il vous plait», dit le garçon.
+2 morceaux de gateau
+EUR remplace FF.
+EOF
+
+LANGUAGE= LC_ALL=fr_FR python prog.py 2 > prog.out || exit 1
+${DIFF} prog.ok prog.out || exit 1
+
+rm -fr $tmpfiles
+
+exit 0