From c8d2120b06e1b82cb0db896aa0f9767b2f14256c Mon Sep 17 00:00:00 2001
From: Thejaswi Puthraya <thejaswi.puthraya@gmail.com>
Date: Tue, 7 Jun 2016 18:32:42 +0530
Subject: [PATCH] Fixed #26705 -- Fixed plural versions of languages not
 supported by Django.

---
 django/utils/translation/trans_real.py |  3 +++
 tests/i18n/tests.py                    | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
index 7a2a1c63a2..d7e97e7ed2 100644
--- a/django/utils/translation/trans_real.py
+++ b/django/utils/translation/trans_real.py
@@ -113,6 +113,9 @@ class DjangoTranslation(gettext_module.GNUTranslations):
         self.__to_language = to_language(language)
         self.__locale = to_locale(language)
         self._catalog = None
+        # If a language doesn't have a catalog, use the Germanic default for
+        # pluralization: anything except one is pluralized.
+        self.plural = lambda n: int(n != 1)
 
         if self.domain == 'django':
             if localedirs is not None:
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py
index 5084f2dc1d..7292bd5a0a 100644
--- a/tests/i18n/tests.py
+++ b/tests/i18n/tests.py
@@ -1925,3 +1925,16 @@ class NonDjangoLanguageTests(SimpleTestCase):
     def test_non_django_language(self):
         self.assertEqual(get_language(), 'xxx')
         self.assertEqual(ugettext("year"), "reay")
+
+    @override_settings(
+        USE_I18N=True,
+        LANGUAGES=[
+            ('en-us', 'English'),
+            # xyz language has no locale files
+            ('xyz', 'XYZ'),
+        ],
+    )
+    @translation.override('xyz')
+    def test_plural_non_django_language(self):
+        self.assertEqual(get_language(), 'xyz')
+        self.assertEqual(ungettext('year', 'years', 2), 'years')