From 59052e48db56626a77d3bef0ea747c2fb12ee90a Mon Sep 17 00:00:00 2001 From: Georg Bauer Date: Sat, 1 Oct 2005 13:28:59 +0000 Subject: [PATCH] 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 --- django/utils/translation.py | 11 +++++++++-- 1 file 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): """