OS : Linux
PHP Version : 7.4.33
Software : Apache/2.4.6 (CentOS) PHP/7.4.33
Information System : Linux apprendre2 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
babel.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.
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.
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
Return a list of all locale identifiers for which locale data is
available.
Returns: list
a list of locale identifiers (strings)
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