#24515 closed Bug (fixed)
Plural handling broken
Reported by: | Claude Paroz | Owned by: | nobody |
---|---|---|---|
Component: | Internationalization | Version: | 1.8rc1 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Translation of plural strings is currently not following the plural equation from the po files and enforce the English default equation.
-
tests/i18n/tests.py
Test case:diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index ad23861..65aedc0 100644
a b from django.utils.translation import ( 30 30 get_language, get_language_from_request, get_language_info, gettext, 31 31 gettext_lazy, ngettext_lazy, npgettext, npgettext_lazy, pgettext, 32 32 pgettext_lazy, string_concat, to_locale, trans_real, ugettext, 33 ugettext_lazy, ungettext _lazy,33 ugettext_lazy, ungettext, ungettext_lazy, 34 34 ) 35 35 36 36 from .forms import CompanyForm, I18nForm, SelectDateForm … … def patch_formats(lang, **settings): 57 57 58 58 class TranslationTests(TestCase): 59 59 60 @translation.override('fr') 61 def test_plural(self): 62 """ 63 Test plurals with ungettext. French differs from English in that 0 is singular. 64 """ 65 self.assertEqual(ungettext("%d year", "%d years", 0) % 0, "0 année") 66 self.assertEqual(ungettext("%d year", "%d years", 2) % 2, "2 années") 67 self.assertEqual(ungettext("%(size)d byte", "%(size)d bytes", 0) % {'size': 0}, "0 octet") 68 self.assertEqual(ungettext("%(size)d byte", "%(size)d bytes", 2) % {'size': 2}, "2 octets") 69 60 70 def test_override(self): 61 71 activate('de') 62 72 try:
Change History (4)
comment:1 by , 10 years ago
Has patch: | set |
---|
comment:2 by , 10 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Note:
See TracTickets
for help on using tickets.
https://github.com/django/django/pull/4356