diff options
author | Souheil CHELFOUH <trollfot@gmail.com> | 2018-10-18 20:36:17 +0200 |
---|---|---|
committer | Souheil CHELFOUH <trollfot@gmail.com> | 2018-10-18 20:36:17 +0200 |
commit | 6c9f3eaa735887c160c6d91916759ac950702479 (patch) | |
tree | 5b691fb5a696d72aa3a8ab96daf922d19eb41c06 | |
parent | af108bd07315b1aa76e5dc2777eb5492a0684f61 (diff) | |
download | zope-i18n-6c9f3eaa735887c160c6d91916759ac950702479.tar.gz |
Added tests for multiple catalogs iteration during pluralization.
-rw-r--r-- | src/zope/i18n/tests/en-alt.mo | bin | 318 -> 361 bytes | |||
-rw-r--r-- | src/zope/i18n/tests/en-alt.po | 5 | ||||
-rw-r--r-- | src/zope/i18n/tests/test_plurals.py | 15 |
3 files changed, 20 insertions, 0 deletions
diff --git a/src/zope/i18n/tests/en-alt.mo b/src/zope/i18n/tests/en-alt.mo Binary files differindex e08bb59..2e7a16a 100644 --- a/src/zope/i18n/tests/en-alt.mo +++ b/src/zope/i18n/tests/en-alt.mo diff --git a/src/zope/i18n/tests/en-alt.po b/src/zope/i18n/tests/en-alt.po index de55bbc..eb439fb 100644 --- a/src/zope/i18n/tests/en-alt.po +++ b/src/zope/i18n/tests/en-alt.po @@ -12,3 +12,8 @@ msgstr "Hey!" msgid "special" msgstr "Wow" + +msgid "apple" +msgid_plural "apple" +msgstr[0] "orange" +msgstr[1] "oranges" diff --git a/src/zope/i18n/tests/test_plurals.py b/src/zope/i18n/tests/test_plurals.py index 79d8347..4f7813e 100644 --- a/src/zope/i18n/tests/test_plurals.py +++ b/src/zope/i18n/tests/test_plurals.py @@ -166,3 +166,18 @@ class TestPlurals(unittest.TestCase): mapping={'type': apple}, target_language="en", number=75), 'There are 75 apples.') + + # Add another catalog, to test the domain's catalogs iteration + # We add this catalog in first position, to resolve the translations + # there first. + alt_en = self._getMessageCatalog('en', variant="alt") + domain._data[alt_en.getIdentifier()] = alt_en + domain._catalogs[alt_en.language].insert(0, alt_en.getIdentifier()) + + apple = factory('apple', msgid_plural='apples', number=42) + self.assertEqual( + translate(msgid='There is %d ${type}.', + msgid_plural='There are %d ${type}.', + mapping={'type': apple}, + target_language="de", number=42), + 'There are 42 oranges.') |