annotate babel/core.py @ 17:aa33ad077d24

Minor date formatting improvements.
author cmlenz
date Thu, 31 May 2007 14:20:04 +0000
parents 29ef15a6fd75
children 6c2c9fc7d787
rev   line source
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
1 # -*- coding: utf-8 -*-
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
2 #
14
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
3 # Copyright (C) 2007 Edgewall Software
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
4 # All rights reserved.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
5 #
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
6 # This software is licensed as described in the file COPYING, which
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
7 # you should have received as part of this distribution. The terms
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
8 # are also available at http://babel.edgewall.org/wiki/License.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
9 #
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
10 # This software consists of voluntary contributions made by many
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
11 # individuals. For the exact contribution history, see the revision
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
12 # history and logs, available at http://babel.edgewall.org/log/.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
13
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
14 """Core locale representation and locale data access gateway."""
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
15
14
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
16 import os
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
17 import pickle
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
18 try:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
19 import threading
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
20 except ImportError:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
21 import dummy_threading as threading
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
22
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
23 __all__ = ['Locale', 'negotiate', 'parse']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
24 __docformat__ = 'restructuredtext en'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
25
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
26
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
27 class Locale(object):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
28 """Representation of a specific locale.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
29
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
30 >>> locale = Locale('en', territory='US')
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
31 >>> repr(locale)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
32 '<Locale "en_US">'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
33 >>> locale.display_name
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
34 u'English (United States)'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
35
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
36 A `Locale` object can also be instantiated from a raw locale string:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
37
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
38 >>> locale = Locale.parse('en-US', sep='-')
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
39 >>> repr(locale)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
40 '<Locale "en_US">'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
41
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
42 `Locale` objects provide access to a collection of locale data, such as
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
43 territory and language names, number and date format patterns, and more:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
44
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
45 >>> locale.number_symbols['decimal']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
46 u'.'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
47
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
48 :see: `IETF RFC 3066 <http://www.ietf.org/rfc/rfc3066.txt>`_
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
49 """
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
50 _cache = {}
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
51 _cache_lock = threading.Lock()
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
52
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
53 def __new__(cls, language, territory=None, variant=None):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
54 """Create new locale object, or load it from the cache if it had already
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
55 been instantiated.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
56
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
57 >>> l1 = Locale('en')
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
58 >>> l2 = Locale('en')
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
59 >>> l1 is l2
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
60 True
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
61
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
62 :param language: the language code
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
63 :param territory: the territory (country or region) code
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
64 :param variant: the variant code
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
65 :return: new or existing `Locale` instance
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
66 :rtype: `Locale`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
67 """
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
68 key = (language, territory, variant)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
69 cls._cache_lock.acquire()
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
70 try:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
71 self = cls._cache.get(key)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
72 if self is None:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
73 self = super(Locale, cls).__new__(cls, language, territory,
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
74 variant)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
75 cls._cache[key] = self
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
76 return self
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
77 finally:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
78 self._cache_lock.release()
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
79
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
80 def __init__(self, language, territory=None, variant=None):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
81 """Initialize the locale object from the given identifier components.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
82
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
83 >>> locale = Locale('en', 'US')
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
84 >>> locale.language
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
85 'en'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
86 >>> locale.territory
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
87 'US'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
88
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
89 :param language: the language code
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
90 :param territory: the territory (country or region) code
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
91 :param variant: the variant code
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
92 """
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
93 self.language = language
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
94 self.territory = territory
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
95 self.variant = variant
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
96 self.__data = None
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
97
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
98 def parse(cls, identifier, sep='_'):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
99 """Create a `Locale` instance for the given locale identifier.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
100
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
101 >>> l = Locale.parse('de-DE', sep='-')
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
102 >>> l.display_name
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
103 u'Deutsch (Deutschland)'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
104
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
105 If the `identifier` parameter is not a string, but actually a `Locale`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
106 object, that object is returned:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
107
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
108 >>> Locale.parse(l)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
109 <Locale "de_DE">
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
110
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
111 :param identifier: the locale identifier string
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
112 :param sep: optional component separator
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
113 :return: a corresponding `Locale` instance
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
114 :rtype: `Locale`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
115 :raise `ValueError`: if the string does not appear to be a valid locale
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
116 identifier
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
117 """
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
118 if type(identifier) is cls:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
119 return identifier
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
120 return cls(*parse(identifier, sep=sep))
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
121 parse = classmethod(parse)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
122
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
123 def __repr__(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
124 return '<Locale "%s">' % str(self)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
125
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
126 def __str__(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
127 return '_'.join(filter(None, [self.language, self.territory,
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
128 self.variant]))
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
129
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
130 def _data(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
131 if self.__data is None:
14
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
132 filename = os.path.join(os.path.dirname(__file__),
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
133 'localedata/%s.dat' % self)
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
134 fileobj = open(filename, 'rb')
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
135 try:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
136 self.__data = pickle.load(fileobj)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
137 finally:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
138 fileobj.close()
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
139 return self.__data
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
140 _data = property(_data)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
141
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
142 def display_name(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
143 retval = self.languages.get(self.language)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
144 if self.territory:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
145 variant = ''
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
146 if self.variant:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
147 variant = ', %s' % self.variants.get(self.variant)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
148 retval += ' (%s%s)' % (self.territories.get(self.territory), variant)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
149 return retval
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
150 display_name = property(display_name, doc="""\
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
151 The localized display name of the locale.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
152
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
153 >>> Locale('en').display_name
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
154 u'English'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
155 >>> Locale('en', 'US').display_name
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
156 u'English (United States)'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
157
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
158 :type: `unicode`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
159 """)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
160
10
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
161 #{ General Locale Display Names
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
162
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
163 def languages(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
164 return self._data['languages']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
165 languages = property(languages, doc="""\
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
166 Mapping of language codes to translated language names.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
167
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
168 >>> Locale('de', 'DE').languages['ja']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
169 u'Japanisch'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
170
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
171 :type: `dict`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
172 :see: `ISO 639 <http://www.loc.gov/standards/iso639-2/>`_
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
173 """)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
174
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
175 def scripts(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
176 return self._data['scripts']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
177 scripts = property(scripts, doc="""\
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
178 Mapping of script codes to translated script names.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
179
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
180 >>> Locale('en', 'US').scripts['Hira']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
181 u'Hiragana'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
182
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
183 :type: `dict`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
184 :see: `ISO 15924 <http://www.evertype.com/standards/iso15924/>`_
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
185 """)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
186
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
187 def territories(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
188 return self._data['territories']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
189 territories = property(territories, doc="""\
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
190 Mapping of script codes to translated script names.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
191
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
192 >>> Locale('es', 'CO').territories['DE']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
193 u'Alemania'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
194
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
195 :type: `dict`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
196 :see: `ISO 3166 <http://www.iso.org/iso/en/prods-services/iso3166ma/>`_
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
197 """)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
198
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
199 def variants(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
200 return self._data['variants']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
201 variants = property(variants, doc="""\
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
202 Mapping of script codes to translated script names.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
203
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
204 >>> Locale('de', 'DE').variants['1901']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
205 u'alte deutsche Rechtschreibung'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
206
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
207 :type: `dict`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
208 """)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
209
10
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
210 #{ Number Formatting
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
211
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
212 def number_symbols(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
213 return self._data['number_symbols']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
214 number_symbols = property(number_symbols, doc="""\
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
215 Symbols used in number formatting.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
216
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
217 >>> Locale('fr', 'FR').number_symbols['decimal']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
218 u','
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
219
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
220 :type: `dict`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
221 """)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
222
14
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
223 def decimal_formats(self):
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
224 return self._data['decimal_formats']
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
225 decimal_formats = property(decimal_formats, doc="""\
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
226 Locale patterns for decimal number formatting.
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
227
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
228 >>> Locale('en', 'US').decimal_formats[None]
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
229 <NumberPattern u'#,##0.###'>
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
230
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
231 :type: `dict`
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
232 """)
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
233
10
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
234 #{ Calendar Information and Date Formatting
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
235
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
236 def periods(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
237 return self._data['periods']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
238 periods = property(periods, doc="""\
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
239 Locale display names for day periods (AM/PM).
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
240
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
241 >>> Locale('en', 'US').periods['am']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
242 u'AM'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
243
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
244 :type: `dict`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
245 """)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
246
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
247 def days(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
248 return self._data['days']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
249 days = property(days, doc="""\
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
250 Locale display names for weekdays.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
251
17
aa33ad077d24 Minor date formatting improvements.
cmlenz
parents: 14
diff changeset
252 >>> Locale('de', 'DE').days['format']['wide'][3]
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
253 u'Donnerstag'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
254
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
255 :type: `dict`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
256 """)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
257
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
258 def months(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
259 return self._data['months']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
260 months = property(months, doc="""\
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
261 Locale display names for months.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
262
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
263 >>> Locale('de', 'DE').months['format']['wide'][10]
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
264 u'Oktober'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
265
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
266 :type: `dict`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
267 """)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
268
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
269 def quarters(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
270 return self._data['quarters']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
271 quarters = property(quarters, doc="""\
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
272 Locale display names for quarters.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
273
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
274 >>> Locale('de', 'DE').quarters['format']['wide'][1]
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
275 u'1. Quartal'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
276
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
277 :type: `dict`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
278 """)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
279
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
280 def eras(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
281 return self._data['eras']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
282 eras = property(eras, doc="""\
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
283 Locale display names for eras.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
284
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
285 >>> Locale('en', 'US').eras['wide'][1]
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
286 u'Anno Domini'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
287 >>> Locale('en', 'US').eras['abbreviated'][0]
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
288 u'BC'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
289
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
290 :type: `dict`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
291 """)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
292
10
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
293 def first_week_day(self):
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
294 return self._data['week_data']['first_day']
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
295 first_week_day = property(first_week_day, doc="""\
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
296 The first day of a week.
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
297
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
298 >>> Locale('de', 'DE').first_week_day
17
aa33ad077d24 Minor date formatting improvements.
cmlenz
parents: 14
diff changeset
299 0
10
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
300 >>> Locale('en', 'US').first_week_day
17
aa33ad077d24 Minor date formatting improvements.
cmlenz
parents: 14
diff changeset
301 6
10
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
302
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
303 :type: `int`
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
304 """)
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
305
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
306 def weekend_start(self):
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
307 return self._data['week_data']['weekend_start']
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
308 weekend_start = property(weekend_start, doc="""\
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
309 The day the weekend starts.
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
310
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
311 >>> Locale('de', 'DE').weekend_start
17
aa33ad077d24 Minor date formatting improvements.
cmlenz
parents: 14
diff changeset
312 5
10
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
313
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
314 :type: `int`
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
315 """)
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
316
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
317 def weekend_end(self):
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
318 return self._data['week_data']['weekend_end']
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
319 weekend_end = property(weekend_end, doc="""\
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
320 The day the weekend ends.
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
321
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
322 >>> Locale('de', 'DE').weekend_end
17
aa33ad077d24 Minor date formatting improvements.
cmlenz
parents: 14
diff changeset
323 6
10
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
324
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
325 :type: `int`
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
326 """)
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
327
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
328 def min_week_days(self):
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
329 return self._data['week_data']['min_days']
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
330 min_week_days = property(min_week_days, doc="""\
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
331 The minimum number of days in a week so that the week is counted as the
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
332 first week of a year or month.
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
333
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
334 >>> Locale('de', 'DE').min_week_days
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
335 4
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
336
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
337 :type: `int`
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
338 """)
0ca5dd65594f Pull in some supplemental data from the CLDR, for things like the first day of the week.
cmlenz
parents: 3
diff changeset
339
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
340 def date_formats(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
341 return self._data['date_formats']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
342 date_formats = property(date_formats, doc="""\
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
343 Locale patterns for date formatting.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
344
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
345 >>> Locale('en', 'US').date_formats['short']
14
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
346 <DateTimePattern u'M/d/yy'>
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
347 >>> Locale('fr', 'FR').date_formats['long']
14
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
348 <DateTimePattern u'd MMMM yyyy'>
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
349
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
350 :type: `dict`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
351 """)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
352
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
353 def time_formats(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
354 return self._data['time_formats']
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
355 time_formats = property(time_formats, doc="""\
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
356 Locale patterns for time formatting.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
357
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
358 >>> Locale('en', 'US').time_formats['short']
14
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
359 <DateTimePattern u'h:mm a'>
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
360 >>> Locale('fr', 'FR').time_formats['long']
14
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 11
diff changeset
361 <DateTimePattern u'HH:mm:ss z'>
11
11f64b232b04 Add basic support for number format patterns.
jonas
parents: 10
diff changeset
362
11f64b232b04 Add basic support for number format patterns.
jonas
parents: 10
diff changeset
363 :type: `dict`
11f64b232b04 Add basic support for number format patterns.
jonas
parents: 10
diff changeset
364 """)
11f64b232b04 Add basic support for number format patterns.
jonas
parents: 10
diff changeset
365
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
366
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
367 def negotiate(preferred, available):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
368 """Find the best match between available and requested locale strings.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
369
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
370 >>> negotiate(['de_DE', 'en_US'], ['de_DE', 'de_AT'])
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
371 'de_DE'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
372 >>> negotiate(['de_DE', 'en_US'], ['en', 'de'])
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
373 'de'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
374
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
375 :param preferred: the list of locale strings preferred by the user
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
376 :param available: the list of locale strings available
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
377 :return: the locale identifier for the best match, or `None` if no match
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
378 was found
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
379 :rtype: `str`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
380 """
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
381 for locale in preferred:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
382 if locale in available:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
383 return locale
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
384 parts = locale.split('_')
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
385 if len(parts) > 1 and parts[0] in available:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
386 return parts[0]
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
387 return None
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
388
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
389 def parse(identifier, sep='_'):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
390 """Parse a locale identifier into a ``(language, territory, variant)``
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
391 tuple.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
392
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
393 >>> parse('zh_CN')
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
394 ('zh', 'CN', None)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
395
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
396 The default component separator is "_", but a different separator can be
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
397 specified using the `sep` parameter:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
398
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
399 >>> parse('zh-CN', sep='-')
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
400 ('zh', 'CN', None)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
401
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
402 :param identifier: the locale identifier string
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
403 :param sep: character that separates the different parts of the locale
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
404 string
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
405 :return: the ``(language, territory, variant)`` tuple
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
406 :rtype: `tuple`
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
407 :raise `ValueError`: if the string does not appear to be a valid locale
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
408 identifier
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
409
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
410 :see: `IETF RFC 3066 <http://www.ietf.org/rfc/rfc3066.txt>`_
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
411 """
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
412 parts = identifier.split(sep)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
413 lang, territory, variant = parts[0].lower(), None, None
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
414 if not lang.isalpha():
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
415 raise ValueError('expected only letters, got %r' % lang)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
416 if len(parts) > 1:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
417 territory = parts[1].upper().split('.', 1)[0]
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
418 if not territory.isalpha():
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
419 raise ValueError('expected only letters, got %r' % territory)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
420 if len(parts) > 2:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
421 variant = parts[2].upper().split('.', 1)[0]
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
422 return lang, territory, variant
Copyright (C) 2012-2017 Edgewall Software