]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Various documentation updates
authorArmin Ronacher <armin.ronacher@active-4.com>
Fri, 26 Jul 2013 14:18:10 +0000 (16:18 +0200)
committerArmin Ronacher <armin.ronacher@active-4.com>
Fri, 26 Jul 2013 14:18:10 +0000 (16:18 +0200)
babel/__init__.py
docs/api/core.rst
docs/dates.rst
docs/display.rst
docs/intro.rst
docs/messages.rst
docs/numbers.rst
docs/setup.rst

index fa5d59af95d73893100e113fb564388c60738a7c..5cca4a8ed575a4189a8e8281980c000606200020 100644 (file)
@@ -18,7 +18,7 @@
 """
 
 from babel.core import UnknownLocaleError, Locale, default_locale, \
-     negotiate_locale, parse_locale
+     negotiate_locale, parse_locale, get_locale_identifier
 
 
 try:
index e554938927083ffd7ce18e1a898eb1d4a3f25705..6993764b86cab43f5b357f38e5a4f0ac9ef951b5 100644 (file)
@@ -7,6 +7,9 @@ The core API provides the basic core functionality.  Primarily it provides
 the :class:`Locale` object and ways to create it.  This object
 encapsulates a locale and exposes all the data it contains.
 
+All the core functionality is also directly importable from the `babel`
+module for convenience.
+
 Basic Interface
 ---------------
 
index 94474f79f2932ffa070debd89f0bf99f2c8c9eff..f03c21ace6f4a8dafffef6116fc806b6f602613e 100644 (file)
@@ -1,5 +1,7 @@
 .. -*- mode: rst; encoding: utf-8 -*-
 
+.. _date-and-time:
+
 =============
 Date and Time
 =============
index 640795c6f0776621a267137a78fe7e7578ae38b3..06901a28b08cdaaf25d20d8a2e610fb891031c48 100644 (file)
@@ -1,5 +1,7 @@
 .. -*- mode: rst; encoding: utf-8 -*-
 
+.. _display-names:
+
 ====================
 Locale Display Names
 ====================
@@ -8,9 +10,9 @@ Locale Display Names
 Introduction
 ============
 
-While `message catalogs <messages.html>`_ allow you to localize any messages
-in your application, there are a number of strings that are used in many
-applications for which translations are readily available.
+While :ref:`message catalogs <messages>` allow you to localize any
+messages in your application, there are a number of strings that are used
+in many applications for which translations are readily available.
 
 Imagine for example you have a list of countries that users can choose from,
 and you'd like to display the names of those countries in the language the
@@ -61,8 +63,7 @@ language:
 
     >>> locale = Locale('es')
     >>> month_names = locale.months['format']['wide'].items()
-    >>> month_names.sort()
-    >>> for idx, name in month_names:
+    >>> for idx, name in sorted(month_names):
     ...     print name
     enero
     febrero
index 0de1a5d69c1b2a4f9182c6ef5992d039b3376aa2..25e006997a35d36c4293fa69bba6318dc613de89 100644 (file)
@@ -16,42 +16,34 @@ localization (L10N) can be separated into two different aspects:
 Message Catalogs
 ================
 
-While the Python standard library includes a
-`gettext <http://docs.python.org/lib/module-gettext.html>`_ module that enables
-applications to use message catalogs, it requires developers to build these
-catalogs using GNU tools such as ``xgettext``, ``msgmerge``, and ``msgfmt``.
-And while ``xgettext`` does have support for extracting messages from Python
-files, it does not know how to deal with other kinds of files commonly found
-in Python web-applications, such as templates, nor does it provide an easy
-extensibility mechanism to add such support.
+While the Python standard library includes a :mod:`gettext` module that
+enables applications to use message catalogs, it requires developers to
+build these catalogs using GNU tools such as ``xgettext``, ``msgmerge``,
+and ``msgfmt``.  And while ``xgettext`` does have support for extracting
+messages from Python files, it does not know how to deal with other kinds
+of files commonly found in Python web-applications, such as templates, nor
+does it provide an easy extensibility mechanism to add such support.
 
-Babel addresses this by providing a framework where various extraction methods
-can be plugged in to a larger message extraction framework, and also removes
-the dependency on the GNU ``gettext`` tools for common tasks, as these aren't
-necessarily available on all platforms. See `Working with Message Catalogs`_
-for details on this aspect of Babel.
-
-.. _`Working with Message Catalogs`: messages.html
+Babel addresses this by providing a framework where various extraction
+methods can be plugged in to a larger message extraction framework, and
+also removes the dependency on the GNU ``gettext`` tools for common tasks,
+as these aren't necessarily available on all platforms. See
+:ref:`messages` for details on this aspect of Babel.
 
 
 Locale Data
 ===========
 
-Furthermore, while the Python standard library does include support for basic
-localization with respect to the formatting of numbers and dates (the
-`locale <http://docs.python.org/lib/module-locale.html>`_ module, among others),
-this support is based on the assumption that there will be only one specific
-locale used per process (at least simultaneously.) Also, it doesn't provide
-access to other kinds of locale data, such as the localized names of countries,
-languages, or time-zones, which are frequently needed in web-based applications.
-
-For these requirements, Babel includes data extracted from the `Common Locale
-Data Repository (CLDR) <http://unicode.org/cldr/>`_, and provides a number of
-convenient methods for accessing and using this data. See `Locale Display
-Names`_, `Date Formatting`_, and `Number Formatting`_ for more information on
-this aspect of Babel.
-
-
-.. _`Locale Display Names`: display.html
-.. _`Date Formatting`: dates.html
-.. _`Number Formatting`: numbers.html
+Furthermore, while the Python standard library does include support for
+basic localization with respect to the formatting of numbers and dates
+(the :mod:`locale` module, among others), this support is based on the
+assumption that there will be only one specific locale used per process
+(at least simultaneously.) Also, it doesn't provide access to other kinds
+of locale data, such as the localized names of countries, languages, or
+time-zones, which are frequently needed in web-based applications.
+
+For these requirements, Babel includes data extracted from the `Common
+Locale Data Repository (CLDR) <http://unicode.org/cldr/>`_, and provides a
+number of convenient methods for accessing and using this data. See
+:ref:`display-names`, :ref:`date-and-time`, and :ref:`numbers` for more
+information on this aspect of Babel.
index 9f4bfab8fc6ca92f18c0a422fd03561aaa6f2a7e..683e7ae729115384bd4c374c40e0cd43ac55cba7 100644 (file)
@@ -1,5 +1,7 @@
 .. -*- mode: rst; encoding: utf-8 -*-
 
+.. _messages:
+
 =============================
 Working with Message Catalogs
 =============================
@@ -45,10 +47,8 @@ The general procedure for building message catalogs looks something like this:
    regenerate the POT file and merge the changes into the various
    locale-specific PO files, for example using ``msgmerge``
 
-Python provides the `gettext module`_ as part of the standard library, which
-enables applications to work with appropriately generated MO files.
-
- .. _`gettext module`: http://docs.python.org/lib/module-gettext.html
+Python provides the :mod:`gettext` module as part of the standard library,
+which enables applications to work with appropriately generated MO files.
 
 As ``gettext`` provides a solid and well supported foundation for translating
 application messages, Babel does not reinvent the wheel, but rather reuses this
@@ -74,13 +74,13 @@ When message extraction is based on directories instead of individual files,
 there needs to be a way to configure which files should be treated in which
 manner. For example, while many projects may contain ``.html`` files, some of
 those files may be static HTML files that don't contain localizable message,
-while others may be `Django`_ templates, and still others may contain `Genshi`_
+while others may be `Jinja2`_ templates, and still others may contain `Genshi`_
 markup templates. Some projects may even mix HTML files for different templates
 languages (for whatever reason). Therefore the way in which messages are
 extracted from source files can not only depend on the file extension, but
 needs to be controllable in a precise manner.
 
-.. _`Django`: http://www.djangoproject.com/
+.. _`Jinja2`: http://jinja.pocoo.org/
 .. _`Genshi`: http://genshi.edgewall.org/
 
 Babel accepts a configuration file to specify this mapping of files to
@@ -161,10 +161,8 @@ for comments. Empty lines are ignored, too.
 .. note:: if you're performing message extraction using the command Babel
           provides for integration into ``setup.py`` scripts, you can also
           provide this configuration in a different way, namely as a keyword
-          argument to the ``setup()`` function. See `Distutils/Setuptools
-          Integration`_ for more information.
-
-.. _`distutils/setuptools integration`: setup.html
+          argument to the ``setup()`` function. See
+          :ref:`setup-integration` for more information.
 
 
 Default Extraction Methods
index 280047291b6559d9b3963b0a9d34b723b540795f..fb71adf1e45f5f82616ae17728d1b0f8a5745c2c 100644 (file)
@@ -1,8 +1,10 @@
 .. -*- mode: rst; encoding: utf-8 -*-
 
-==========================
+.. _numbers:
+
+=================
 Number Formatting
-==========================
+=================
 
 
 Support for locale-specific formatting and parsing of numbers is provided by
index 6bb2a02d07e7c8744759da54bfde66aebac4c1f1..ef203e9d54e8fe4cea76fd8968b43f857ea112cf 100644 (file)
@@ -1,5 +1,7 @@
 .. -*- mode: rst; encoding: utf-8 -*-
 
+.. _setup-integration:
+
 ================================
 Distutils/Setuptools Integration
 ================================