intro.rst 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. .. -*- mode: rst; encoding: utf-8 -*-
  2. ============
  3. Introduction
  4. ============
  5. The functionality Babel provides for internationalization (I18n) and
  6. localization (L10N) can be separated into two different aspects:
  7. * tools to build and work with ``gettext`` message catalogs, and
  8. * a Python interface to the CLDR (Common Locale Data Repository), providing
  9. access to various locale display names, localized number and date
  10. formatting, etc.
  11. Message Catalogs
  12. ================
  13. While the Python standard library includes a :mod:`gettext` module that
  14. enables applications to use message catalogs, it requires developers to
  15. build these catalogs using GNU tools such as ``xgettext``, ``msgmerge``,
  16. and ``msgfmt``. And while ``xgettext`` does have support for extracting
  17. messages from Python files, it does not know how to deal with other kinds
  18. of files commonly found in Python web-applications, such as templates, nor
  19. does it provide an easy extensibility mechanism to add such support.
  20. Babel addresses this by providing a framework where various extraction
  21. methods can be plugged in to a larger message extraction framework, and
  22. also removes the dependency on the GNU ``gettext`` tools for common tasks,
  23. as these aren't necessarily available on all platforms. See
  24. :ref:`messages` for details on this aspect of Babel.
  25. Locale Data
  26. ===========
  27. Furthermore, while the Python standard library does include support for
  28. basic localization with respect to the formatting of numbers and dates
  29. (the :mod:`locale` module, among others), this support is based on the
  30. assumption that there will be only one specific locale used per process
  31. (at least simultaneously.) Also, it doesn't provide access to other kinds
  32. of locale data, such as the localized names of countries, languages, or
  33. time-zones, which are frequently needed in web-based applications.
  34. For these requirements, Babel includes data extracted from the `Common
  35. Locale Data Repository (CLDR) <http://unicode.org/cldr/>`_, and provides a
  36. number of convenient methods for accessing and using this data. See
  37. :ref:`locale-data`, :ref:`date-and-time`, and :ref:`numbers` for more
  38. information on this aspect of Babel.