wichert/lingua — pull request #10 by tmassman (2012-03-03 11:42:11+00:00)
Title: Added support for extracting plural forms from zope.i18nmessageid messages

With the plural form support for zope.i18n* (see https://bitbucket.org/thomas_massmann/zope.i18nmessageid and https://bitbucket.org/thomas_massmann/zope.i18n - I will merge it into the SVN soon) it is necessary to support the extraction of those messages and their plural forms as well.

A new method ```stateWaitForPlural``` looks for the plural parameter, but only if the ```funcname``` (or keyword) is within one of the plural keywords: ngettext, ungettext.

In Zope, a Message ID is then defined like:

```python
from zope.i18nmessageid import MessageFactory
_ = MessageFactory('my.package')

message_one = _.ungettext(u'There is one file.', plural=u'There are %d files.')

message_two = _.ungettext(u'label_other_files', u'There are %d other files.',
default=u'There is another file.',
)
```

The result looks something like this:

```python
#: src/my/package/__init__.py:4
#, python-format
msgid "There is one file."
msgid_plural "There are %d files."
msgstr[0] ""
msgstr[1] ""
```

Default texts are only supported for singular versions:

```python
#. Default: There is another file.
#: src/my/package/__init__.py:6
#, python-format
msgid "label_other_files"
msgid_plural "There are %d other files."
msgstr[0] ""
msgstr[1] ""
```

I know that lingua is widely used by Pyramid, and there plural messages are handled in another way. I haven't tested this within Pyramid, but it should not affect it.

Cheers,
Thomas