diff options
| author | Georg Bauer <gb@hugo.westfalen.de> | 2005-10-01 12:47:22 +0000 |
|---|---|---|
| committer | Georg Bauer <gb@hugo.westfalen.de> | 2005-10-01 12:47:22 +0000 |
| commit | 4eb73a35848bb31e84ee6ae002224ba5023968b4 (patch) | |
| tree | 2ba69c1a2d6e7425af3ebc8f603f0092b9387c91 /django/utils | |
| parent | 3049adf4859319a19e6a0f72eb172a13b71aaf06 (diff) | |
i18n now has support for ngettext and has unittests
git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@755 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/translation.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/django/utils/translation.py b/django/utils/translation.py index 6385c7b26b..7cbaa27217 100644 --- a/django/utils/translation.py +++ b/django/utils/translation.py @@ -149,6 +149,14 @@ def gettext_noop(message): """ return message +def ngettext(singular, plural, number): + """ + This function returns the translation of either the singular + or plural, based on the number. + """ + if number == 1: return gettext(singular) + else: return gettext(plural) + def get_language_from_request(request): """ analyze the request to find what language the user |
