summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWaldemar Kornewald <wkornewald@gmail.com>2016-12-09 15:07:25 +0100
committerTim Graham <timograham@gmail.com>2016-12-14 18:39:35 -0500
commit0d8cdb5bc4513e959cf13fd96b21489e9045aa74 (patch)
treef3cd247337f100b940880a13b2f094124a06fa45 /tests
parent14fe184e17f7e56e80fff884860090ad72c3c25d (diff)
[1.10.x] Fixed #27418 -- Fixed occasional missing plural forms in JavaScriptCatalog.
Backport of b24af2f40508bc0d8aa0cef264e51c537ffb92bd from master
Diffstat (limited to 'tests')
-rw-r--r--tests/view_tests/locale/pt/LC_MESSAGES/djangojs.mobin0 -> 539 bytes
-rw-r--r--tests/view_tests/locale/pt/LC_MESSAGES/djangojs.po27
-rw-r--r--tests/view_tests/locale/ru/LC_MESSAGES/djangojs.mobin489 -> 597 bytes
-rw-r--r--tests/view_tests/locale/ru/LC_MESSAGES/djangojs.po13
-rw-r--r--tests/view_tests/tests/test_i18n.py12
-rw-r--r--tests/view_tests/tests/test_i18n_deprecated.py12
6 files changed, 64 insertions, 0 deletions
diff --git a/tests/view_tests/locale/pt/LC_MESSAGES/djangojs.mo b/tests/view_tests/locale/pt/LC_MESSAGES/djangojs.mo
new file mode 100644
index 0000000000..8407e242fc
--- /dev/null
+++ b/tests/view_tests/locale/pt/LC_MESSAGES/djangojs.mo
Binary files differ
diff --git a/tests/view_tests/locale/pt/LC_MESSAGES/djangojs.po b/tests/view_tests/locale/pt/LC_MESSAGES/djangojs.po
new file mode 100644
index 0000000000..ca643162e9
--- /dev/null
+++ b/tests/view_tests/locale/pt/LC_MESSAGES/djangojs.po
@@ -0,0 +1,27 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2007-09-15 19:15+0200\n"
+"PO-Revision-Date: 2010-05-12 12:41-0300\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid "{count} plural2"
+msgid_plural "{count} plural2s"
+msgstr[0] "{count} plural2"
+msgstr[1] "{count} plural2s"
+
+msgid "{count} plural3"
+msgid_plural "{count} plural3s"
+msgstr[0] "{count} plural3"
+msgstr[1] "{count} plural3s"
diff --git a/tests/view_tests/locale/ru/LC_MESSAGES/djangojs.mo b/tests/view_tests/locale/ru/LC_MESSAGES/djangojs.mo
index 21659a93d3..cb0a8d10db 100644
--- a/tests/view_tests/locale/ru/LC_MESSAGES/djangojs.mo
+++ b/tests/view_tests/locale/ru/LC_MESSAGES/djangojs.mo
Binary files differ
diff --git a/tests/view_tests/locale/ru/LC_MESSAGES/djangojs.po b/tests/view_tests/locale/ru/LC_MESSAGES/djangojs.po
index 4ea193a880..e9eda86192 100644
--- a/tests/view_tests/locale/ru/LC_MESSAGES/djangojs.po
+++ b/tests/view_tests/locale/ru/LC_MESSAGES/djangojs.po
@@ -22,3 +22,16 @@ msgstr "перевод"
msgid "Choose a time"
msgstr "Выберите время"
+
+
+msgid "{count} plural2"
+msgid_plural "{count} plural2s"
+msgstr[0] ""
+msgstr[1] ""
+msgstr[2] ""
+
+msgid "{count} plural3"
+msgid_plural "{count} plural3s"
+msgstr[0] "{count} plural3 p3"
+msgstr[1] "{count} plural3 p3s"
+msgstr[2] "{count} plural3 p3t"
diff --git a/tests/view_tests/tests/test_i18n.py b/tests/view_tests/tests/test_i18n.py
index 074080a77b..7ac1872152 100644
--- a/tests/view_tests/tests/test_i18n.py
+++ b/tests/view_tests/tests/test_i18n.py
@@ -297,6 +297,18 @@ class JsI18NTests(SimpleTestCase):
self.assertContains(response, 'il faut le traduire')
self.assertNotContains(response, "Untranslated string")
+ def test_i18n_fallback_language_plural(self):
+ """
+ The fallback to a language with less plural forms maintains the real
+ language's number of plural forms.
+ """
+ with self.settings(LANGUAGE_CODE='pt'), override('ru'):
+ response = self.client.get('/jsi18n/')
+ self.assertEqual(
+ response.context['catalog']['{count} plural3'],
+ ['{count} plural3', '{count} plural3s', '{count} plural3 p3t']
+ )
+
def test_i18n_english_variant(self):
with override('en-gb'):
response = self.client.get('/jsi18n/')
diff --git a/tests/view_tests/tests/test_i18n_deprecated.py b/tests/view_tests/tests/test_i18n_deprecated.py
index 88ce57f47a..e60a04ad01 100644
--- a/tests/view_tests/tests/test_i18n_deprecated.py
+++ b/tests/view_tests/tests/test_i18n_deprecated.py
@@ -95,6 +95,18 @@ class JsI18NTests(SimpleTestCase):
self.assertContains(response, 'il faut le traduire')
self.assertNotContains(response, "Untranslated string")
+ def test_i18n_fallback_language_plural(self):
+ """
+ The fallback to a language with less plural forms maintains the real
+ language's number of plural forms.
+ """
+ with self.settings(LANGUAGE_CODE='pt'), override('ru'):
+ response = self.client.get('/jsi18n/')
+ self.assertEqual(
+ response.context['catalog']['{count} plural3'],
+ ['{count} plural3', '{count} plural3s', '{count} plural3 p3t']
+ )
+
def test_i18n_english_variant(self):
with override('en-gb'):
response = self.client.get('/old_jsi18n/')