Mercurial > babel > old > babel-test
view doc/display.txt @ 23:bd45ff425485
Added line-wrap support for `write_po`.
Fixed bug on the distutils frontend regarding the `keywords`.
author | palgarvio |
---|---|
date | Thu, 31 May 2007 22:44:57 +0000 |
parents | b2492365f186 |
children | 9552a500e7fd |
line wrap: on
line source
.. -*- mode: rst; encoding: utf-8 -*- ==================== Locale Display Names ==================== .. contents:: Contents :depth: 2 .. sectnum:: Introduction ============ While `message catalogs <catalogs.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. 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 user prefers. Instead of translating all those country names yourself in your application, you can make use of the translations provided by the locale data included with Babel, which is based on the `Common Locale Data Repository (CLDR) <http://unicode.org/cldr/>`_ developed and maintained by the `Unicode Consortium <http://unicode.org/>`_. The ``Locale`` Class ==================== You normally access such locale data through the `Locale`_ class provided by Babel:: >>> from babel import Locale >>> locale = Locale('en', 'US') >>> locale.territories['US'] u'United States' >>> locale = Locale('es', 'MX') >>> locale.territories['US'] u'Estados Unidos' .. _`Locale`: api/babel.core.Locale-class.html In addition to country/territory names, the locale data also provides access to names of languages, scripts, variants, time zones, and more. Some of the data is closely related to `number and date formatting`_. Most of the corresponding ``Locale`` properties return dictionaries, where the key is a code such as the ISO country and language codes. Consult the API documentation for references to the relevant specifications. .. _`number and date formatting`: formatting.html