summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorGeorg Bauer <gb@hugo.westfalen.de>2005-10-01 13:28:59 +0000
committerGeorg Bauer <gb@hugo.westfalen.de>2005-10-01 13:28:59 +0000
commit59052e48db56626a77d3bef0ea747c2fb12ee90a (patch)
tree0a5933824d3e1ed14ba789ca516c5e93817d7655 /django
parent2c6e366f0ae5cb8167f992adb7d43c0f95fc4018 (diff)
i18n: switched ngettext to make use of the standard ngettext instead simulating via gettext
git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@758 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/utils/translation.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/django/utils/translation.py b/django/utils/translation.py
index 7cbaa27217..37feeb91ed 100644
--- a/django/utils/translation.py
+++ b/django/utils/translation.py
@@ -154,8 +154,15 @@ 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)
+ global _default, _active
+
+ t = _active.get(currentThread(), None)
+ if t is not None:
+ return t.ngettext(singular, plural, number)
+ if _default is None:
+ from django.conf import settings
+ _default = translation('*', settings.LANGUAGE_CODE)
+ return _default.ngettext(singular, plural, number)
def get_language_from_request(request):
"""