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