# HG changeset patch # User cmlenz # Date 1271457098 0 # Node ID 80f80f2eec6a2c10783ca1fa8e4f8c9eb0972015 # Parent 5a1c0ee0f659e1f5aa630e7a563e14684a0387a4 Started extending the i18n docs. diff --git a/doc/i18n.txt b/doc/i18n.txt --- a/doc/i18n.txt +++ b/doc/i18n.txt @@ -5,14 +5,14 @@ ===================================== Genshi provides basic supporting infrastructure for internationalizing -and localizing templates. That includes functionality for extracting localizable -strings from templates, as well as a template filter that can apply translations -to templates as they get rendered. +and localizing templates. That includes functionality for extracting +localizable strings from templates, as well as a template filter that can +apply translations to templates as they get rendered. This support is based on `gettext`_ message catalogs and the `gettext Python -module`_. The extraction process can be used from the API level, or through the -front-ends implemented by the `Babel`_ project, for which Genshi provides a -plugin. +module`_. The extraction process can be used from the API level, or through +the front-ends implemented by the `Babel`_ project, for which Genshi provides +a plugin. .. _`gettext`: http://www.gnu.org/software/gettext/ .. _`gettext python module`: http://docs.python.org/lib/module-gettext.html @@ -28,14 +28,15 @@ ====== The simplest way to internationalize and translate templates would be to wrap -all localizable strings in a ``gettext()`` function call (which is often aliased -to ``_()`` for brevity). In that case, no extra template filter is required. +all localizable strings in a ``gettext()`` function call (which is often +aliased to ``_()`` for brevity). In that case, no extra template filter is +required. .. code-block:: genshi

${_("Hello, world!")}

-However, this approach results in significant “character noise” in templates, +However, this approach results in significant “character noise” in templates, making them harder to read and preview. The ``genshi.filters.Translator`` filter allows you to get rid of the @@ -48,23 +49,28 @@ This text will still be extracted and translated as if you had wrapped it in a ``_()`` call. -.. note:: For parameterized or pluralizable messages, you need to continue using - the appropriate ``gettext`` functions. +.. note:: For parameterized or pluralizable messages, you need to use the + special `template directives`_ described below, or use the + corresponding ``gettext`` function in embedded Python expressions. -You can control which tags should be ignored by this process; for example, it +You can control which tags should be ignored by this process; for example, it doesn't really make sense to translate the content of the HTML ```` element. Both ``