babel.localedata
Low-level locale data access.
note: The Locale class, which uses this module under the hood, provides a more convenient interface for accessing the locale data. exists(name)Check whether locale data is available for the given locale.
param name: the locale identifier string return: True if the locale data exists, False otherwise rtype: bool list()Return a list of all locale identifiers for which locale data is available.
return: a list of locale identifiers (strings) rtype: list since: version 0.8.1 load(name, merge_inherited=True)Load the locale data for the given locale.
The locale data is a dictionary that contains much of the data defined by the Common Locale Data Repository (CLDR). This data is stored as a collection of pickle files inside the babel package.
>>> d = load('en_US') >>> d['languages']['sv'] u'Swedish'Note that the results are cached, and subsequent requests for the same locale return the same dictionary:
>>> d1 = load('en_US') >>> d2 = load('en_US') >>> d1 is d2 Trueparam name: the locale identifier string (or "root") param merge_inherited: whether the inherited data should be merged into the data of the requested locale return: the locale data rtype: dict raise IOError: if no locale data file is found for the given locale identifer, or one of the locales it inherits from merge(dict1, dict2)Merge the data from dict2 into the dict1 dictionary, making copies of nested dictionaries.
>>> d = {1: 'foo', 3: 'baz'} >>> merge(d, {1: 'Foo', 2: 'Bar'}) >>> d {1: 'Foo', 2: 'Bar', 3: 'baz'}param dict1: the dictionary to merge into param dict2: the dictionary containing the data that should be merged Alias
Representation of an alias in the locale data.
An alias is a value that refers to some other part of the locale data, as specified by the keys.
resolve(self, data)Resolve the alias based on the given data.
This is done recursively, so if one alias resolves to a second alias, that second alias will also be resolved.
param data: the locale data type data: dict
LocaleDataDict
Dictionary wrapper that automatically resolves aliases to the actual values.
copy(self)(Not documented)
See ApiDocs, Documentation
