diff options
author | Aymeric Augustin <aymeric.augustin@oscaro.com> | 2015-04-01 22:36:51 +0200 |
---|---|---|
committer | Aymeric Augustin <aymeric.augustin@oscaro.com> | 2015-04-01 22:37:11 +0200 |
commit | 85205514783fdd6957bdf98a04730bc90415cb19 (patch) | |
tree | 5a1940e1671177fe20c9e93ba4979082822663ad | |
parent | 1b605838bf1fa5527fd82b0f94d11c43d41f3f81 (diff) | |
download | django-85205514783fdd6957bdf98a04730bc90415cb19.tar.gz |
Pointed Jinja2 users to Babel instead of makemessages.
-rw-r--r-- | docs/topics/i18n/translation.txt | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt index ea295ae8ca..21c1e64daf 100644 --- a/docs/topics/i18n/translation.txt +++ b/docs/topics/i18n/translation.txt @@ -1330,6 +1330,32 @@ multiple times:: <creating-message-files-from-js-code>` you need to use the special 'djangojs' domain, **not** ``-e js``. +.. admonition:: Using Jinja2 templates? + + :djadmin:`makemessages` doesn't understand the syntax of Jinja2 templates. + To extract strings from a project containing Jinja2 templates, use Babel_ + instead. + + Here's an example ``babel.cfg`` configuration file:: + + # Extraction from Python source files + [python: **.py] + + # Extraction from Jinja2 templates + [jinja2: **.jinja] + extensions = jinja2.ext.with_ + + Make sure you list all extensions you're using! Otherwise Babel won't + recognize the tags defined by these extensions and will ignore Jinja2 + templates containing them entirely. + + Babel provides similar features to :djadmin:`makemessages`, can replace it + in general, and doesn't depend on ``gettext``. For more information, read + its documentation about `working with message catalogs`_. + + .. _Babel: http://babel.pocoo.org/ + .. _working with message catalogs: http://babel.pocoo.org/docs/messages/ + .. admonition:: No gettext? If you don't have the ``gettext`` utilities installed, |