Mercurial > babel > mirror
view doc/support.txt @ 487:9020d6780181 stable-0.9.x
Merged revisions 484-489 via svnmerge from
http://svn.edgewall.org/repos/babel/trunk
........
r484 | jruigrok | 2010-02-19 14:16:08 +0100 (vr, 19 feb 2010) | 4 lines
Fix testcase name typo.
Switch to use a locale that uses a different singular and plural form instead
of just one form for both singular and plural.
........
r485 | jruigrok | 2010-02-19 14:38:24 +0100 (vr, 19 feb 2010) | 2 lines
Add a test for a locale with one plural form.
........
r486 | jruigrok | 2010-02-19 14:45:25 +0100 (vr, 19 feb 2010) | 3 lines
Put the square brackets test after all the normal plural tests. It's more
logical.
........
r487 | jruigrok | 2010-02-19 15:12:41 +0100 (vr, 19 feb 2010) | 2 lines
More than two plural forms work nowadays. Adjust the test.
........
r488 | jruigrok | 2010-02-19 15:15:56 +0100 (vr, 19 feb 2010) | 2 lines
Actually make the msgid_plural be a plural as per typical use case.
........
r489 | jruigrok | 2010-02-24 13:27:32 +0100 (wo, 24 feb 2010) | 2 lines
Forgot to bump the copyright line.
........
author | jruigrok |
---|---|
date | Sun, 11 Apr 2010 09:09:11 +0000 |
parents | 839c93f1f090 |
children |
line wrap: on
line source
.. -*- mode: rst; encoding: utf-8 -*- ============================= Support Classes and Functions ============================= .. contents:: Contents :depth: 2 .. sectnum:: The ``babel.support`` modules contains a number of classes and functions that can help with integrating Babel, and internationalization in general, into your application or framework. The code in this module is not used by Babel itself, but instead is provided to address common requirements of applications that should handle internationalization. --------------- Lazy Evaluation --------------- One such requirement is lazy evaluation of translations. Many web-based applications define some localizable message at the module level, or in general at some level where the locale of the remote user is not yet known. For such cases, web frameworks generally provide a "lazy" variant of the ``gettext`` functions, which basically translates the message not when the ``gettext`` function is invoked, but when the string is accessed in some manner. --------------------------- Extended Translations Class --------------------------- Many web-based applications are composed of a variety of different components (possibly using some kind of plugin system), and some of those components may provide their own message catalogs that need to be integrated into the larger system. To support this usage pattern, Babel provides a ``Translations`` class that is derived from the ``GNUTranslations`` class in the ``gettext`` module. This class adds a ``merge()`` method that takes another ``Translations`` instance, and merges the content of the latter into the main catalog: .. code-block:: python translations = Translations.load('main') translations.merge(Translations.load('plugin1'))