intro.txt 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. .. contents:: Contents
  12. :depth: 2
  13. .. sectnum::
  14. Message Catalogs
  15. ================
  16. While the Python standard library includes a
  17. `gettext <http://docs.python.org/lib/module-gettext.html>`_ module that enables
  18. applications to use message catalogs, it requires developers to build these
  19. catalogs using GNU tools such as ``xgettext``, ``msgmerge``, and ``msgfmt``.
  20. And while ``xgettext`` does have support for extracting messages from Python
  21. files, it does not know how to deal with other kinds of files commonly found
  22. in Python web-applications, such as templates, nor does it provide an easy
  23. extensibility mechanism to add such support.
  24. Babel addresses this by providing a framework where various extraction methods
  25. can be plugged in to a larger message extraction framework, and also removes
  26. the dependency on the GNU ``gettext`` tools for common tasks, as these aren't
  27. necessarily available on all platforms. See `Working with Message Catalogs`_
  28. for details on this aspect of Babel.
  29. .. _`Working with Message Catalogs`: messages.html
  30. Locale Data
  31. ===========
  32. Furthermore, while the Python standard library does include support for basic
  33. localization with respect to the formatting of numbers and dates (the
  34. `locale <http://docs.python.org/lib/module-locale.html>`_ module, among others),
  35. this support is based on the assumption that there will be only one specific
  36. locale used per process (at least simultaneously.) Also, it doesn't provide
  37. access to other kinds of locale data, such as the localized names of countries,
  38. languages, or time-zones, which are frequently needed in web-based applications.
  39. For these requirements, Babel includes data extracted from the `Common Locale
  40. Data Repository (CLDR) <http://unicode.org/cldr/>`_, and provides a number of
  41. convenient methods for accessing and using this data. See `Locale Display
  42. Names`_, `Date Formatting`_, and `Number Formatting`_ for more information on
  43. this aspect of Babel.
  44. .. _`Locale Display Names`: display.html
  45. .. _`Date Formatting`: dates.html
  46. .. _`Number Formatting`: numbers.html