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