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