annotate doc/display.txt @ 497:4eaad9bf0e5a

Prevent multiple handlers being attached to the same logger. Issue: #227 Submitted by: dfraser
author jruigrok
date Tue, 22 Feb 2011 14:30:22 +0000
parents bf1bcdf19111
children
rev   line source
2
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
1 .. -*- mode: rst; encoding: utf-8 -*-
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
2
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
3 ====================
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
4 Locale Display Names
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
5 ====================
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
6
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
7 .. contents:: Contents
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
8 :depth: 2
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
9 .. sectnum::
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
10
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
11
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
12 Introduction
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
13 ============
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
14
124
bf1bcdf19111 Split docs on date and number formatting.
cmlenz
parents: 40
diff changeset
15 While `message catalogs <messages.html>`_ allow you to localize any messages
2
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
16 in your application, there are a number of strings that are used in many
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
17 applications for which translations are readily available.
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
18
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
19 Imagine for example you have a list of countries that users can choose from,
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
20 and you'd like to display the names of those countries in the language the
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
21 user prefers. Instead of translating all those country names yourself in your
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
22 application, you can make use of the translations provided by the locale data
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
23 included with Babel, which is based on the `Common Locale Data Repository
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
24 (CLDR) <http://unicode.org/cldr/>`_ developed and maintained by the `Unicode
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
25 Consortium <http://unicode.org/>`_.
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
26
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
27
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
28 The ``Locale`` Class
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
29 ====================
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
30
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
31 You normally access such locale data through the `Locale`_ class provided
40
4525549aa6cc Syntax highlighting for the docs.
cmlenz
parents: 25
diff changeset
32 by Babel:
4525549aa6cc Syntax highlighting for the docs.
cmlenz
parents: 25
diff changeset
33
4525549aa6cc Syntax highlighting for the docs.
cmlenz
parents: 25
diff changeset
34 .. code-block:: pycon
2
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
35
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
36 >>> from babel import Locale
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
37 >>> locale = Locale('en', 'US')
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
38 >>> locale.territories['US']
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
39 u'United States'
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
40 >>> locale = Locale('es', 'MX')
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
41 >>> locale.territories['US']
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
42 u'Estados Unidos'
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
43
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
44 .. _`Locale`: api/babel.core.Locale-class.html
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
45
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
46 In addition to country/territory names, the locale data also provides access to
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
47 names of languages, scripts, variants, time zones, and more. Some of the data
124
bf1bcdf19111 Split docs on date and number formatting.
cmlenz
parents: 40
diff changeset
48 is closely related to number and date formatting.
2
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
49
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
50 Most of the corresponding ``Locale`` properties return dictionaries, where the
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
51 key is a code such as the ISO country and language codes. Consult the API
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
52 documentation for references to the relevant specifications.
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
53
25
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
54
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
55 Calender Display Names
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
56 ======================
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
57
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
58 The `Locale`_ class provides access to many locale display names related to
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
59 calendar display, such as the names of week days or months.
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
60
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
61 These display names are of course used for date formatting, but can also be
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
62 used, for example, to show a list of months to the user in their preferred
40
4525549aa6cc Syntax highlighting for the docs.
cmlenz
parents: 25
diff changeset
63 language:
4525549aa6cc Syntax highlighting for the docs.
cmlenz
parents: 25
diff changeset
64
4525549aa6cc Syntax highlighting for the docs.
cmlenz
parents: 25
diff changeset
65 .. code-block:: pycon
25
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
66
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
67 >>> locale = Locale('es')
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
68 >>> month_names = locale.months['format']['wide'].items()
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
69 >>> month_names.sort()
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
70 >>> for idx, name in month_names:
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
71 ... print name
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
72 enero
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
73 febrero
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
74 marzo
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
75 abril
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
76 mayo
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
77 junio
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
78 julio
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
79 agosto
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
80 septiembre
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
81 octubre
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
82 noviembre
9552a500e7fd Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
83 diciembre
Copyright (C) 2012-2017 Edgewall Software