Package babel :: Module localedata

# Module 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.

Functions

`bool`

exists(name) Check whether locale data is available for the given locale. |

list

list() Return a list of all locale identifiers for which locale data is available. |

`dict`

load(name, merge_inherited=True) Load the locale data for the given locale. |

Function Details

### exists(name)

Check whether locale data is available for the given locale.

Parameters:
  - `name` - the locale identifier string
Returns: `bool`
  `True` if the locale data exists, `False` otherwise

### list()

Return a list of all locale identifiers for which locale data is available.

Returns: list
  a list of locale identifiers (strings)

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
    True

Parameters:
  - `name` - the locale identifier string (or "root")
  - `merge_inherited` - whether the inherited data should be merged into the data of the requested locale
Returns: `dict`
  the locale data
Raises:
  - `IOError` - if no locale data file is found for the given locale identifer, or one of the locales it inherits from