Skip to content

Commit

Permalink
fix the add_translation_dirs documentation to reflect the current impl
Browse files Browse the repository at this point in the history
fixes #1473
  • Loading branch information
mmerickel committed Jan 17, 2017
1 parent b24aeb7 commit c137452
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions pyramid/config/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,19 @@ def add_translation_dirs(self, *specs):
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).
The translation directories are defined as a list in which
translations defined later have precedence over translations defined
earlier.
If multiple specs are provided in a single call to
``add_translation_dirs``, the directories will be inserted in the
order they're provided (earlier items are trumped by later items).
.. warning::
Consecutive calls to ``add_translation_dirs`` will sort the
directories such that the later calls will add folders with
lower precedence than earlier calls.
"""
introspectables = []
Expand All @@ -76,7 +80,7 @@ def register():

# defer spec resolution until register to allow for asset
# overrides to take place in an earlier config phase
for spec in specs[::-1]: # reversed
for spec in specs[::-1]: # reversed
# the trailing slash helps match asset overrides for folders
if not spec.endswith('/'):
spec += '/'
Expand Down

0 comments on commit c137452

Please sign in to comment.