comparison doc/display.txt @ 2:b2492365f186

Forgot to check in the doc directory.
author cmlenz
date Wed, 30 May 2007 07:37:26 +0000
parents
children 9552a500e7fd
comparison
equal deleted inserted replaced
1:f71ca60f2a4a 2:b2492365f186
1 .. -*- mode: rst; encoding: utf-8 -*-
2
3 ====================
4 Locale Display Names
5 ====================
6
7 .. contents:: Contents
8 :depth: 2
9 .. sectnum::
10
11
12 Introduction
13 ============
14
15 While `message catalogs <catalogs.html>`_ allow you to localize any messages
16 in your application, there are a number of strings that are used in many
17 applications for which translations are readily available.
18
19 Imagine for example you have a list of countries that users can choose from,
20 and you'd like to display the names of those countries in the language the
21 user prefers. Instead of translating all those country names yourself in your
22 application, you can make use of the translations provided by the locale data
23 included with Babel, which is based on the `Common Locale Data Repository
24 (CLDR) <http://unicode.org/cldr/>`_ developed and maintained by the `Unicode
25 Consortium <http://unicode.org/>`_.
26
27
28 The ``Locale`` Class
29 ====================
30
31 You normally access such locale data through the `Locale`_ class provided
32 by Babel::
33
34 >>> from babel import Locale
35 >>> locale = Locale('en', 'US')
36 >>> locale.territories['US']
37 u'United States'
38 >>> locale = Locale('es', 'MX')
39 >>> locale.territories['US']
40 u'Estados Unidos'
41
42 .. _`Locale`: api/babel.core.Locale-class.html
43
44 In addition to country/territory names, the locale data also provides access to
45 names of languages, scripts, variants, time zones, and more. Some of the data
46 is closely related to `number and date formatting`_.
47
48 Most of the corresponding ``Locale`` properties return dictionaries, where the
49 key is a code such as the ISO country and language codes. Consult the API
50 documentation for references to the relevant specifications.
51
52 .. _`number and date formatting`: formatting.html
Copyright (C) 2012-2017 Edgewall Software