annotate doc/display.txt @ 25:1b9956f20649 trunk

Add doc section on calender display names.
author cmlenz
date Fri, 01 Jun 2007 16:15:56 +0000
parents 20896f1e91c6
children 0739bc8e7210
rev   line source
2
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
1 .. -*- mode: rst; encoding: utf-8 -*-
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
2
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
3 ====================
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
4 Locale Display Names
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
5 ====================
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
6
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
7 .. contents:: Contents
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
8 :depth: 2
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
9 .. sectnum::
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
10
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
11
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
12 Introduction
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
13 ============
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
14
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
15 While `message catalogs <catalogs.html>`_ allow you to localize any messages
20896f1e91c6 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
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
17 applications for which translations are readily available.
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
18
20896f1e91c6 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,
20896f1e91c6 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
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
21 user prefers. Instead of translating all those country names yourself in your
20896f1e91c6 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
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
23 included with Babel, which is based on the `Common Locale Data Repository
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
24 (CLDR) <http://unicode.org/cldr/>`_ developed and maintained by the `Unicode
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
25 Consortium <http://unicode.org/>`_.
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
26
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
27
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
28 The ``Locale`` Class
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
29 ====================
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
30
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
31 You normally access such locale data through the `Locale`_ class provided
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
32 by Babel::
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
33
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
34 >>> from babel import Locale
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
35 >>> locale = Locale('en', 'US')
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
36 >>> locale.territories['US']
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
37 u'United States'
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
38 >>> locale = Locale('es', 'MX')
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
39 >>> locale.territories['US']
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
40 u'Estados Unidos'
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
41
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
42 .. _`Locale`: api/babel.core.Locale-class.html
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
43
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
44 In addition to country/territory names, the locale data also provides access to
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
45 names of languages, scripts, variants, time zones, and more. Some of the data
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
46 is closely related to `number and date formatting`_.
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
47
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
48 Most of the corresponding ``Locale`` properties return dictionaries, where the
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
49 key is a code such as the ISO country and language codes. Consult the API
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
50 documentation for references to the relevant specifications.
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
51
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
52 .. _`number and date formatting`: formatting.html
25
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
53
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
54
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
55 Calender Display Names
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
56 ======================
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
57
1b9956f20649 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
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
59 calendar display, such as the names of week days or months.
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
60
1b9956f20649 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
1b9956f20649 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
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
63 language::
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
64
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
65 >>> locale = Locale('es')
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
66 >>> month_names = locale.months['format']['wide'].items()
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
67 >>> month_names.sort()
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
68 >>> for idx, name in month_names:
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
69 ... print name
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
70 enero
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
71 febrero
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
72 marzo
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
73 abril
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
74 mayo
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
75 junio
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
76 julio
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
77 agosto
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
78 septiembre
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
79 octubre
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
80 noviembre
1b9956f20649 Add doc section on calender display names.
cmlenz
parents: 2
diff changeset
81 diciembre
Copyright (C) 2012-2017 Edgewall Software