Permalink
Browse files

let jinja2.i18n.domain default to pyramid application package name

  • Loading branch information...
1 parent 819c248 commit a921e01ef1ed47fd52b5d861b0fd9a9340d161bf @domenkozar domenkozar committed Jan 19, 2013
Showing with 17 additions and 2 deletions.
  1. +4 −0 CHANGES.txt
  2. +12 −1 docs/index.rst
  3. +1 −1 pyramid_jinja2/__init__.py
View
4 CHANGES.txt
@@ -1,6 +1,10 @@
1.6 (unreleased)
================
+- Set `jinja2.i18n.domain` default to the package name
+ of the pyramid application.
+ [Domen Kožar]
+
- Add `jinja2.globals` setting to add global objects into
the template context
[Eugene Fominykh]
View
13 docs/index.rst
@@ -210,6 +210,17 @@ Overriding templates in this style uses the standard
.. _settings:
+Internalization (i18n)
+----------------------
+
+When :term:`pyramid_jinja2` is included as pyramid application,
+:ref:`jinja2.ext.i18n <jinja2:i18n-extension>` is automatically activated.
+
+Be sure to configure `jinja2.i18n.domain` according to `setup.cfg` domain
+settings. By default, `jinja2.i18n.domain` is set to the package name of
+the pyramid application.
+
+
Settings
========
@@ -345,7 +356,7 @@ locations where each line represents an extension. :ref:`jinja2.ext.i18n
jinja2.i18n.domain
------------------
Pyramid domain for translations. See :term:`Translation Domain` in Pyramid
-documentation.
+documentation. Defaults to the package name of the pyramid application.
.. _setting_jinja2_filers:
View
2 pyramid_jinja2/__init__.py
@@ -270,7 +270,7 @@ def _get_or_build_default_environment(registry):
# get supplementary junja2 settings
input_encoding = settings.get('jinja2.input_encoding', 'utf-8')
- domain = settings.get('jinja2.i18n.domain', 'messages')
+ domain = settings.get('jinja2.i18n.domain', package and package.__name__ or 'messages')
# get jinja2 extensions
extensions = parse_multiline(settings.get('jinja2.extensions', ''))

0 comments on commit a921e01

Please sign in to comment.