cmlenz@2: .. -*- mode: rst; encoding: utf-8 -*- cmlenz@2: cmlenz@2: ===== cmlenz@2: Babel cmlenz@2: ===== cmlenz@2: cmlenz@14: .. image:: logo_small.png cmlenz@14: :width: 158 cmlenz@14: :height: 85 cmlenz@14: :align: center cmlenz@14: :alt: Babel cmlenz@14: :class: logo cmlenz@2: cmlenz@2: --------------------------------------------------- cmlenz@2: Simple Internationalization for Python Applications cmlenz@2: --------------------------------------------------- cmlenz@2: cmlenz@2: Babel is an integrated collection of utilities that assist in cmlenz@2: internationalizing and localizing Python applications, with an cmlenz@2: emphasis on web-based applications. cmlenz@2: cmlenz@2: * `Working with Message Catalogs `_ cmlenz@2: * `Locale Display Names `_ cmlenz@2: * `Number and Date Formatting `_ cmlenz@2: * `Command-Line Interface `_ cmlenz@2: * `Distutils/Setuptools Integration `_ cmlenz@2: * `Generated API Documentation `_ cmlenz@2: cmlenz@2: Introduction cmlenz@2: ------------ cmlenz@2: cmlenz@2: The functionality Babel provides for internationalization (I18n) and cmlenz@2: localization (L10N) can be separated into two different aspects: cmlenz@2: cmlenz@2: * tools to build and work with ``gettext`` message catalogs, and cmlenz@2: * a Python interface to the CLDR (Common Locale Data Repository), providing cmlenz@2: access to various locale display names, localized number and date cmlenz@2: formatting, etc. cmlenz@2: cmlenz@2: While the Python standard library includes a cmlenz@2: `gettext `_ module that enables cmlenz@2: applications to use message catalogs, it requires developers to build these cmlenz@2: catalogs using GNU tools such as ``xgettext``, ``msgmerge``, and ``msgfmt``. cmlenz@2: And while ``xgettext`` does have support for extracting messages from Python cmlenz@2: files, it does not know how to deal with other kinds of files commonly found cmlenz@2: in Python web-applications, such as templates, nor does it provide an easy cmlenz@2: extensibility mechanism to add such support. cmlenz@2: cmlenz@2: Babel addresses this by providing a framework where various extraction methods cmlenz@2: can be plugged in to a larger message extraction framework, and also removes cmlenz@2: the dependency on the GNU ``gettext`` tools for common tasks, as these aren't cmlenz@2: necessarily available on all platforms. See `Working with Message Catalogs`_ cmlenz@2: for details on this aspect of Babel. cmlenz@2: cmlenz@2: Furthermore, while the Python standard library does include support for basic cmlenz@2: localization with respect to the formatting of numbers and dates (the cmlenz@2: `locale `_ module, among others), cmlenz@2: this support is based on the assumption that there will be only one specific cmlenz@2: locale used per process (at least simultaneously.) Also, it doesn't provide cmlenz@2: access to other kinds of locale data, such as the localized names of countries, cmlenz@38: languages, or time-zones, which are frequently needed in web-based applications. cmlenz@2: cmlenz@2: For these requirements, Babel includes data extracted from the `Common Locale cmlenz@2: Data Repository (CLDR) `_, and provides a number of cmlenz@2: convenient methods for accessing and using this data. See `Locale Display cmlenz@2: Names`_ and `Number and Date Formatting`_ for more information on this aspect cmlenz@2: of Babel. cmlenz@2: