Edgewall Software
Please note:

The documentation here is generated live, in a way that is neither comprehensive nor 100% correct. We strongly recommend using the HTML documentation included with the source tarballs instead.

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)

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
True
param name:the locale identifier string (or "root")
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.

param dict1:the dictionary to merge into
param dict2:the dictionary containing the data that should be merged


See ApiDocs/0.8, Documentation

Last modified 15 months ago Last modified on Dec 10, 2015 6:25:47 AM