summaryrefslogtreecommitdiff
path: root/tests/i18n/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/i18n/tests.py')
-rw-r--r--tests/i18n/tests.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py
index 2377c8992e..54de250cce 100644
--- a/tests/i18n/tests.py
+++ b/tests/i18n/tests.py
@@ -98,6 +98,22 @@ class TranslationTests(SimpleTestCase):
self.assertEqual(g('%d year', '%d years', 1) % 1, '1 year')
self.assertEqual(g('%d year', '%d years', 2) % 2, '2 years')
+ @override_settings(LOCALE_PATHS=extended_locale_paths)
+ @translation.override('fr')
+ def test_multiple_plurals_per_language(self):
+ """
+ Normally, French has 2 plurals. As other/locale/fr/LC_MESSAGES/django.po
+ has a different plural equation with 3 plurals, this tests if those
+ plural are honored.
+ """
+ self.assertEqual(ngettext("%d singular", "%d plural", 0) % 0, "0 pluriel1")
+ self.assertEqual(ngettext("%d singular", "%d plural", 1) % 1, "1 singulier")
+ self.assertEqual(ngettext("%d singular", "%d plural", 2) % 2, "2 pluriel2")
+ french = trans_real.catalog()
+ # Internal _catalog can query subcatalogs (from different po files).
+ self.assertEqual(french._catalog[('%d singular', 0)], '%d singulier')
+ self.assertEqual(french._catalog[('%d hour', 0)], '%d heure')
+
def test_override(self):
activate('de')
try: