diff options
| -rw-r--r-- | CHANGES.txt | 13 | ||||
| -rw-r--r-- | pyramid/config.py | 11 | ||||
| -rw-r--r-- | pyramid/tests/localeapp/locale2/GARBAGE | 1 | ||||
| -rw-r--r-- | pyramid/tests/localeapp/locale2/be/LC_MESSAGES | 1 | ||||
| -rw-r--r-- | pyramid/tests/localeapp/locale2/de/LC_MESSAGES/deformsite.mo | bin | 0 -> 543 bytes | |||
| -rw-r--r-- | pyramid/tests/localeapp/locale2/de/LC_MESSAGES/deformsite.po | 31 | ||||
| -rw-r--r-- | pyramid/tests/localeapp/locale2/en/LC_MESSAGES/deformsite.mo | bin | 0 -> 543 bytes | |||
| -rw-r--r-- | pyramid/tests/localeapp/locale2/en/LC_MESSAGES/deformsite.po | 31 | ||||
| -rw-r--r-- | pyramid/tests/localeapp/locale3/GARBAGE | 1 | ||||
| -rw-r--r-- | pyramid/tests/localeapp/locale3/be/LC_MESSAGES | 1 | ||||
| -rw-r--r-- | pyramid/tests/localeapp/locale3/de/LC_MESSAGES/deformsite.mo | bin | 0 -> 543 bytes | |||
| -rw-r--r-- | pyramid/tests/localeapp/locale3/de/LC_MESSAGES/deformsite.po | 31 | ||||
| -rw-r--r-- | pyramid/tests/localeapp/locale3/en/LC_MESSAGES/deformsite.mo | bin | 0 -> 543 bytes | |||
| -rw-r--r-- | pyramid/tests/localeapp/locale3/en/LC_MESSAGES/deformsite.po | 31 | ||||
| -rw-r--r-- | pyramid/tests/test_config.py | 26 |
15 files changed, 177 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index f4cd65b36..f03dcd067 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -8,6 +8,19 @@ Bug Fixes for ``pyramid.paster.PyramidTemplate``. Now one has been added, although a deprecation warning is raised. +- If multiple specs were provided in a single call to + ``config.add_translation_dirs``, the directories were inserted into the + beginning of the directory list in the wrong order: they were inserted in + the reverse of the order they were provided in the ``*specs`` list (items + later in the list trumped ones earlier in the list). This is now fixed. + + Note however, that later calls to ``config.add_translation_dirs`` continue + to insert directories into the beginning of the list of translation + directories created by earlier calls. This means that the same translation + found in a directory added via ``add_translation_dirs`` later in the + configuration process will be found before one added earlier via a separate + call to ``add_translation_dirs`` in the configuration process. + Backwards Incompatibilities --------------------------- diff --git a/pyramid/config.py b/pyramid/config.py index 1e4cbb350..77f5b5b34 100644 --- a/pyramid/config.py +++ b/pyramid/config.py @@ -2245,8 +2245,17 @@ class Configurator(object): config.add_translation_dirs('/usr/share/locale', 'some.package:locale') + Later calls to ``add_translation_dir`` insert directories into the + beginning of the list of translation directories created by earlier + calls. This means that the same translation found in a directory + added later in the configuration process will be found before one + added earlier in the configuration process. However, if multiple + specs are provided in a single call to ``add_translation_dirs``, the + directories will be inserted into the beginning of the directory list + in the order they're provided in the ``*specs`` list argument (items + earlier in the list trump ones later in the list). """ - for spec in specs: + for spec in specs[::-1]: # reversed package_name, filename = self._split_spec(spec) if package_name is None: # absolute filename diff --git a/pyramid/tests/localeapp/locale2/GARBAGE b/pyramid/tests/localeapp/locale2/GARBAGE new file mode 100644 index 000000000..032c55584 --- /dev/null +++ b/pyramid/tests/localeapp/locale2/GARBAGE @@ -0,0 +1 @@ +Garbage file. diff --git a/pyramid/tests/localeapp/locale2/be/LC_MESSAGES b/pyramid/tests/localeapp/locale2/be/LC_MESSAGES new file mode 100644 index 000000000..909cf6a3b --- /dev/null +++ b/pyramid/tests/localeapp/locale2/be/LC_MESSAGES @@ -0,0 +1 @@ +busted. diff --git a/pyramid/tests/localeapp/locale2/de/LC_MESSAGES/deformsite.mo b/pyramid/tests/localeapp/locale2/de/LC_MESSAGES/deformsite.mo Binary files differnew file mode 100644 index 000000000..2924a5eb5 --- /dev/null +++ b/pyramid/tests/localeapp/locale2/de/LC_MESSAGES/deformsite.mo diff --git a/pyramid/tests/localeapp/locale2/de/LC_MESSAGES/deformsite.po b/pyramid/tests/localeapp/locale2/de/LC_MESSAGES/deformsite.po new file mode 100644 index 000000000..17f87bc19 --- /dev/null +++ b/pyramid/tests/localeapp/locale2/de/LC_MESSAGES/deformsite.po @@ -0,0 +1,31 @@ +# German translations for deformsite. +# Copyright (C) 2010 ORGANIZATION +# This file is distributed under the same license as the deformsite project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2010. +# +msgid "" +msgstr "" +"Project-Id-Version: deformsite 0.0\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2010-04-22 14:17+0400\n" +"PO-Revision-Date: 2010-04-22 14:17-0400\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: de <LL@li.org>\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 0.9.5\n" + +#: deformsite/__init__.py:458 +msgid "Approve" +msgstr "Genehmigen" + +#: deformsite/__init__.py:459 +msgid "Show approval" +msgstr "Zeigen Genehmigung" + +#: deformsite/__init__.py:466 +msgid "Submit" +msgstr "Beugen" + diff --git a/pyramid/tests/localeapp/locale2/en/LC_MESSAGES/deformsite.mo b/pyramid/tests/localeapp/locale2/en/LC_MESSAGES/deformsite.mo Binary files differnew file mode 100644 index 000000000..2924a5eb5 --- /dev/null +++ b/pyramid/tests/localeapp/locale2/en/LC_MESSAGES/deformsite.mo diff --git a/pyramid/tests/localeapp/locale2/en/LC_MESSAGES/deformsite.po b/pyramid/tests/localeapp/locale2/en/LC_MESSAGES/deformsite.po new file mode 100644 index 000000000..17f87bc19 --- /dev/null +++ b/pyramid/tests/localeapp/locale2/en/LC_MESSAGES/deformsite.po @@ -0,0 +1,31 @@ +# German translations for deformsite. +# Copyright (C) 2010 ORGANIZATION +# This file is distributed under the same license as the deformsite project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2010. +# +msgid "" +msgstr "" +"Project-Id-Version: deformsite 0.0\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2010-04-22 14:17+0400\n" +"PO-Revision-Date: 2010-04-22 14:17-0400\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: de <LL@li.org>\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 0.9.5\n" + +#: deformsite/__init__.py:458 +msgid "Approve" +msgstr "Genehmigen" + +#: deformsite/__init__.py:459 +msgid "Show approval" +msgstr "Zeigen Genehmigung" + +#: deformsite/__init__.py:466 +msgid "Submit" +msgstr "Beugen" + diff --git a/pyramid/tests/localeapp/locale3/GARBAGE b/pyramid/tests/localeapp/locale3/GARBAGE new file mode 100644 index 000000000..032c55584 --- /dev/null +++ b/pyramid/tests/localeapp/locale3/GARBAGE @@ -0,0 +1 @@ +Garbage file. diff --git a/pyramid/tests/localeapp/locale3/be/LC_MESSAGES b/pyramid/tests/localeapp/locale3/be/LC_MESSAGES new file mode 100644 index 000000000..909cf6a3b --- /dev/null +++ b/pyramid/tests/localeapp/locale3/be/LC_MESSAGES @@ -0,0 +1 @@ +busted. diff --git a/pyramid/tests/localeapp/locale3/de/LC_MESSAGES/deformsite.mo b/pyramid/tests/localeapp/locale3/de/LC_MESSAGES/deformsite.mo Binary files differnew file mode 100644 index 000000000..2924a5eb5 --- /dev/null +++ b/pyramid/tests/localeapp/locale3/de/LC_MESSAGES/deformsite.mo diff --git a/pyramid/tests/localeapp/locale3/de/LC_MESSAGES/deformsite.po b/pyramid/tests/localeapp/locale3/de/LC_MESSAGES/deformsite.po new file mode 100644 index 000000000..17f87bc19 --- /dev/null +++ b/pyramid/tests/localeapp/locale3/de/LC_MESSAGES/deformsite.po @@ -0,0 +1,31 @@ +# German translations for deformsite. +# Copyright (C) 2010 ORGANIZATION +# This file is distributed under the same license as the deformsite project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2010. +# +msgid "" +msgstr "" +"Project-Id-Version: deformsite 0.0\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2010-04-22 14:17+0400\n" +"PO-Revision-Date: 2010-04-22 14:17-0400\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: de <LL@li.org>\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 0.9.5\n" + +#: deformsite/__init__.py:458 +msgid "Approve" +msgstr "Genehmigen" + +#: deformsite/__init__.py:459 +msgid "Show approval" +msgstr "Zeigen Genehmigung" + +#: deformsite/__init__.py:466 +msgid "Submit" +msgstr "Beugen" + diff --git a/pyramid/tests/localeapp/locale3/en/LC_MESSAGES/deformsite.mo b/pyramid/tests/localeapp/locale3/en/LC_MESSAGES/deformsite.mo Binary files differnew file mode 100644 index 000000000..2924a5eb5 --- /dev/null +++ b/pyramid/tests/localeapp/locale3/en/LC_MESSAGES/deformsite.mo diff --git a/pyramid/tests/localeapp/locale3/en/LC_MESSAGES/deformsite.po b/pyramid/tests/localeapp/locale3/en/LC_MESSAGES/deformsite.po new file mode 100644 index 000000000..17f87bc19 --- /dev/null +++ b/pyramid/tests/localeapp/locale3/en/LC_MESSAGES/deformsite.po @@ -0,0 +1,31 @@ +# German translations for deformsite. +# Copyright (C) 2010 ORGANIZATION +# This file is distributed under the same license as the deformsite project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2010. +# +msgid "" +msgstr "" +"Project-Id-Version: deformsite 0.0\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2010-04-22 14:17+0400\n" +"PO-Revision-Date: 2010-04-22 14:17-0400\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: de <LL@li.org>\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 0.9.5\n" + +#: deformsite/__init__.py:458 +msgid "Approve" +msgstr "Genehmigen" + +#: deformsite/__init__.py:459 +msgid "Show approval" +msgstr "Zeigen Genehmigung" + +#: deformsite/__init__.py:466 +msgid "Submit" +msgstr "Beugen" + diff --git a/pyramid/tests/test_config.py b/pyramid/tests/test_config.py index 12146895d..dd8bf109f 100644 --- a/pyramid/tests/test_config.py +++ b/pyramid/tests/test_config.py @@ -2499,6 +2499,32 @@ class ConfiguratorTests(unittest.TestCase): result = config.registry.getUtility(ITranslationDirectories) self.assertEqual(result, [locale, 'abc']) + def test_add_translation_dirs_multiple_specs(self): + import os + from pyramid.interfaces import ITranslationDirectories + config = self._makeOne(autocommit=True) + config.add_translation_dirs('pyramid.tests.localeapp:locale', + 'pyramid.tests.localeapp:locale2') + here = os.path.dirname(__file__) + locale = os.path.join(here, 'localeapp', 'locale') + locale2 = os.path.join(here, 'localeapp', 'locale2') + self.assertEqual(config.registry.getUtility(ITranslationDirectories), + [locale, locale2]) + + def test_add_translation_dirs_multiple_specs_multiple_calls(self): + import os + from pyramid.interfaces import ITranslationDirectories + config = self._makeOne(autocommit=True) + config.add_translation_dirs('pyramid.tests.localeapp:locale', + 'pyramid.tests.localeapp:locale2') + config.add_translation_dirs('pyramid.tests.localeapp:locale3') + here = os.path.dirname(__file__) + locale = os.path.join(here, 'localeapp', 'locale') + locale2 = os.path.join(here, 'localeapp', 'locale2') + locale3 = os.path.join(here, 'localeapp', 'locale3') + self.assertEqual(config.registry.getUtility(ITranslationDirectories), + [locale3, locale, locale2]) + def test_add_translation_dirs_registers_chameleon_translate(self): from pyramid.interfaces import IChameleonTranslate from pyramid.threadlocal import manager |
