# HG changeset patch # User cmlenz # Date 1177924332 0 # Node ID b9303e10cc2a9456f7c31f987d28e1438dacccba # Parent 77919e46413b286eee60a470b67a31451f470a07 Ported [569] to 0.4.x. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,10 @@ tuple for a given string. * Added frameset variants to the `DocType` constants for HTML 4.01 and XHTML 1.0. + * Improved I18n extraction for pluralizable messages: for any translation + function with multiple string arguments (such as ``ngettext``), a single + item with a tuple of strings is yielded, instead an item for each string + argument. Version 0.4 diff --git a/genshi/filters/i18n.py b/genshi/filters/i18n.py --- a/genshi/filters/i18n.py +++ b/genshi/filters/i18n.py @@ -174,7 +174,8 @@ * ``lineno`` is the number of the line on which the string was found, * ``function`` is the name of the ``gettext`` function used (if the string was extracted from embedded Python code), and - * ``message`` is the string itself (a ``unicode`` object). + * ``message`` is the string itself (a ``unicode`` object, or a tuple + of ``unicode`` objects for functions with multiple string arguments). >>> from genshi.template import MarkupTemplate >>> @@ -185,6 +186,7 @@ ...
...${_("Hello, %(name)s") % dict(name=username)}
+ ...${ngettext("You have %d item", "You have %d items", num)}
... ...