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