Edgewall Software
Please note:

The documentation here is generated live, in a way that is neither comprehensive nor 100% correct. We strongly recommend using the HTML documentation included with the source tarballs instead.

babel.messages.plurals

Plural form definitions.

_PluralTuple

A tuple with plural information.

get_plural(locale=LC_CTYPE)

A tuple with the information catalogs need to perform proper pluralization. The first item of the tuple is the number of plural forms, the second the plural expression.

>>> get_plural(locale='en')
(2, '(n != 1)')
>>> get_plural(locale='ga')
(3, '(n==1 ? 0 : n==2 ? 1 : 2)')

The object returned is a special tuple with additional members:

>>> tup = get_plural("ja")
>>> tup.num_plurals
1
>>> tup.plural_expr
'0'
>>> tup.plural_forms
'npurals=1; plural=0'

Converting the tuple into a string prints the plural forms for a gettext catalog:

>>> str(tup)
'npurals=1; plural=0'


See ApiDocs/0.9, Documentation