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

`dict`

load(name) 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

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

Parameters:
  - `name` - the locale identifier string (or "root")
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