Please sign in to comment.
1. add docs explaining how to get i18n to work with jinja2 templates
2. At present in i18n.py, the method get_localizer creates a default Translations object. The domain of these translations is the default 'messages'. If subsequent translations are found, they are added as fallbacks, so they cannot be accessed unless the domain is passed in. This causes trouble since jinja2 does not call dgettext, but rather gettext. This patch changes get_localizer such that it finds all the translations in the translation dirs and puts them in the list. it uses the first one found as default, and calls translations.add passing in any additional translations objects found. If no translations were found, then we create the default Translations object with domain messages. 3. After this fix was made, two tests broke. As it turns out there is a deformsite.mo file in the en directory, but it has German translations. I regenerated these files to have English in them. A minor tweak was made to the test for get_localizer after testing a translation to German, a new request is created, the current_locale is set to english, and we call localizer.translate expecting english to be returned. it is returned.
- Loading branch information...
Showing with 124 additions and 7 deletions.
Binary file not shown.