diff options
| author | Chris McDonough <chrism@plope.com> | 2011-05-14 14:13:53 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-05-14 14:13:53 -0400 |
| commit | 5119ae79997869eafb7e98e57e0d996acdb5a678 (patch) | |
| tree | 5f40cdb39a78b8b48dfc8c9b3a91c0d1a2dfae3e /docs | |
| parent | 3b08ba6ab807f8f56e03d30a896cfacbcea4116c (diff) | |
| download | pyramid-5119ae79997869eafb7e98e57e0d996acdb5a678.tar.gz pyramid-5119ae79997869eafb7e98e57e0d996acdb5a678.tar.bz2 pyramid-5119ae79997869eafb7e98e57e0d996acdb5a678.zip | |
use lingua in docs (thanks to wichert)
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/glossary.rst | 4 | ||||
| -rw-r--r-- | docs/narr/i18n.rst | 71 |
2 files changed, 42 insertions, 33 deletions
diff --git a/docs/glossary.rst b/docs/glossary.rst index 13de8c41a..f96f72ea4 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -746,6 +746,10 @@ Glossary additional locale functionality becomes available to your application. + Lingua + A package by Wichert Akkermann which provides :term:`Babel` message + extractors for Python source files and Chameleon ZPT template files. + Message Identifier A string used as a translation lookup key during localization. The ``msgid`` argument to a :term:`translation string` is a diff --git a/docs/narr/i18n.rst b/docs/narr/i18n.rst index 218b7a2b4..e928c6efb 100644 --- a/docs/narr/i18n.rst +++ b/docs/narr/i18n.rst @@ -247,63 +247,67 @@ GNU gettext uses three types of files in the translation framework, is the ``.mo`` file. Compiling the translations to machine code makes the localized program run faster. -The tool for working with :term:`gettext` translation files related to -a :app:`Pyramid` application is :term:`Babel`. +The tools for working with :term:`gettext` translation files related to a +:app:`Pyramid` application is :term:`Babel` and :term:`Lingua`. Lingua is a +Balel extension that provides support for scraping i18n references out of +Python and Chameleon files. .. index:: single: Babel + single: Lingua .. _installing_babel: -Installing Babel -~~~~~~~~~~~~~~~~ +Installing Babel and Lingua +~~~~~~~~~~~~~~~~~~~~~~~~~~~ -In order for the commands related to working with ``gettext`` -translation files to work properly, you will need to have -:term:`Babel` installed into the same environment in which -:app:`Pyramid` is installed. +In order for the commands related to working with ``gettext`` translation +files to work properly, you will need to have :term:`Babel` and +:term:`Lingua` installed into the same environment in which :app:`Pyramid` is +installed. Installation on UNIX ++++++++++++++++++++ -If the :term:`virtualenv` into which you've installed your -:app:`Pyramid` application lives in ``/my/virtualenv``, you can -install Babel like so: +If the :term:`virtualenv` into which you've installed your :app:`Pyramid` +application lives in ``/my/virtualenv``, you can install Babel and Lingua +like so: .. code-block:: text $ cd /my/virtualenv - $ bin/easy_install Babel + $ bin/easy_install Babel lingua Installation on Windows +++++++++++++++++++++++ -If the :term:`virtualenv` into which you've installed your -:app:`Pyramid` application lives in ``C:\my\virtualenv``, you can -install Babel like so: +If the :term:`virtualenv` into which you've installed your :app:`Pyramid` +application lives in ``C:\my\virtualenv``, you can install Babel and Lingua +like so: .. code-block:: text C> cd \my\virtualenv - C> bin\easy_install Babel + C> bin\easy_install Babel lingua .. index:: single: Babel; message extractors + single: Lingua Changing the ``setup.py`` +++++++++++++++++++++++++ -You need to add a few boilerplate lines to your application's -``setup.py`` file in order to properly generate :term:`gettext` files -from your application. +You need to add a few boilerplate lines to your application's ``setup.py`` +file in order to properly generate :term:`gettext` files from your +application. .. note:: See :ref:`project_narr` to learn about about the composition of an application's ``setup.py`` file. -In particular, add the ``Babel`` distribution to the -``install_requires`` list and insert a set of references to -:term:`Babel` *message extractors* within the call to -:func:`setuptools.setup` inside your application's ``setup.py`` file: +In particular, add the ``Babel`` and ``lingua`` distributions to the +``install_requires`` list and insert a set of references to :term:`Babel` +*message extractors* within the call to :func:`setuptools.setup` inside your +application's ``setup.py`` file: .. code-block:: python :linenos: @@ -313,16 +317,17 @@ In particular, add the ``Babel`` distribution to the install_requires = [ # ... 'Babel', + 'lingua', ], message_extractors = { '.': [ - ('**.py', 'chameleon_python', None ), - ('**.pt', 'chameleon_xml', None ), + ('**.py', 'lingua_python', None ), + ('**.pt', 'lingua_xml', None ), ]}, ) -The ``message_extractors`` stanza placed into the ``setup.py`` file -causes the :term:`Babel` message catalog extraction machinery to also -consider ``**.pt`` files when doing message id extraction. +The ``message_extractors`` stanza placed into the ``setup.py`` file causes +the :term:`Babel` message catalog extraction machinery to also consider +``*.pt`` files when doing message id extraction. .. index:: pair: extracting; messages @@ -332,11 +337,11 @@ consider ``**.pt`` files when doing message id extraction. Extracting Messages from Code and Templates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Once :term:`Babel` is installed and your application's ``setup.py`` -file has the correct message extractor references, you may extract a -message catalog template from the code and :term:`Chameleon` templates -which reside in your :app:`Pyramid` application. You run a -``setup.py`` command to extract the messages: +Once Babel and Lingua are installed and your application's ``setup.py`` file +has the correct message extractor references, you may extract a message +catalog template from the code and :term:`Chameleon` templates which reside +in your :app:`Pyramid` application. You run a ``setup.py`` command to +extract the messages: .. code-block:: text |
