![]() |
Qucs-S S-parameter Viewer & RF Synthesis Tools
|
Classes | |
| class | Alias |
| class | LocaleDataDict |
Functions | |
| str|None | normalize_locale (str name) |
| str | resolve_locale_filename (os.PathLike[str]|str name) |
| bool | exists (str name) |
| list[str] | locale_identifiers () |
| bool | _is_non_likely_script (str name) |
| dict[str, Any] | load (os.PathLike[str]|str name, bool merge_inherited=True) |
| None | merge (MutableMapping[Any, Any] dict1, Mapping[Any, Any] dict2) |
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.
:copyright: (c) 2013-2025 by the Babel Team.
:license: BSD, see LICENSE for more details.
|
protected |
Return whether the locale is of the form ``lang_Script``, and the script is not the likely script for the language. This implements the behavior of the ``nonlikelyScript`` value of the ``localRules`` attribute for parent locales added in CLDR 45.
| bool babel.localedata.exists | ( | str | name | ) |
Check whether locale data is available for the given locale. Returns `True` if it exists, `False` otherwise. :param name: the locale identifier string
| dict[str, Any] babel.localedata.load | ( | os.PathLike[str] | str | name, |
| bool | 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
:param name: the locale identifier string (or "root")
:param merge_inherited: whether the inherited data should be merged into
the data of the requested locale
:raise `IOError`: if no locale data file is found for the given locale
identifier, or one of the locales it inherits from
| list[str] babel.localedata.locale_identifiers | ( | ) |
Return a list of all locale identifiers for which locale data is available. This data is cached after the first invocation. You can clear the cache by calling `locale_identifiers.cache_clear()`. .. versionadded:: 0.8.1 :return: a list of locale identifiers (strings)
| None babel.localedata.merge | ( | MutableMapping[Any, Any] | dict1, |
| Mapping[Any, Any] | 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'})
>>> sorted(d.items())
[(1, 'Foo'), (2, 'Bar'), (3, 'baz')]
:param dict1: the dictionary to merge into
:param dict2: the dictionary containing the data that should be merged
| str | None babel.localedata.normalize_locale | ( | str | name | ) |
Normalize a locale ID by stripping spaces and apply proper casing. Returns the normalized locale ID string or `None` if the ID is not recognized.
| str babel.localedata.resolve_locale_filename | ( | os.PathLike[str] | str | name | ) |
Resolve a locale identifier to a `.dat` path on disk.