~ubuntu-branches/ubuntu/trusty/python-babel/trusty

« back to all changes in this revision

Viewing changes to docs/intro.rst

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-10-28 10:11:31 UTC
  • mfrom: (4.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20131028101131-zwbmm8sc29iemmlr
Tags: 1.3-2ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - debian/rules: Run the testsuite during builds.

Show diffs side-by-side

added added

removed removed

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