Back to index

python3.2  3.2.2
Functions | Variables
locale Namespace Reference

Functions

def _strcoll
def _strxfrm
def localeconv
def setlocale
def _grouping_intervals
 Number formatting APIs.
def _group
def _strip_padding
def format
def _format
def format_string
def currency
def str
def atof
def atoi
def _test
def normalize
def _parse_localename
def _build_localename
def getdefaultlocale
def getlocale
def resetlocale
def getpreferredencoding
def _print_locale

Variables

list __all__
int CHAR_MAX = 127
int LC_ALL = 6
int LC_COLLATE = 3
int LC_CTYPE = 0
int LC_MESSAGES = 5
int LC_MONETARY = 4
int LC_NUMERIC = 1
int LC_TIME = 2
 Error = ValueError
 strxfrm = _strxfrm
 strcoll = _strcoll
 _localeconv = localeconv
dictionary _override_localeconv = {}
tuple _percent_re
 _setlocale = setlocale
 Locale name aliasing engine.
dictionary locale_encoding_alias
 Database.
dictionary locale_alias
dictionary windows_locale

Detailed Description

Locale support.

The module provides low-level access to the C lib's locale APIs
and adds high level number formatting APIs as well as a locale
aliasing engine to complement these.

The aliasing engine includes support for many commonly used locale
names and maps them to values suitable for passing to the C lib's
setlocale() function. It also includes default encodings for all
supported locale names.

Function Documentation

def locale._build_localename (   localetuple) [private]
Builds a locale code from the given tuple (language code,
    encoding).

    No aliasing or normalizing takes place.

Definition at line 437 of file locale.py.

00437 
00438 def _build_localename(localetuple):
00439 
00440     """ Builds a locale code from the given tuple (language code,
00441         encoding).
00442 
00443         No aliasing or normalizing takes place.
00444 
00445     """
00446     language, encoding = localetuple
00447     if language is None:
00448         language = 'C'
00449     if encoding is None:
00450         return language
00451     else:
00452         return language + '.' + encoding

Here is the caller graph for this function:

def locale._format (   percent,
  value,
  grouping = False,
  monetary = False,
  additional 
) [private]

Definition at line 199 of file locale.py.

00199 
00200 def _format(percent, value, grouping=False, monetary=False, *additional):
00201     if additional:
00202         formatted = percent % ((value,) + additional)
00203     else:
00204         formatted = percent % value
00205     # floats and decimal ints need special action!
00206     if percent[-1] in 'eEfFgG':
00207         seps = 0
00208         parts = formatted.split('.')
00209         if grouping:
00210             parts[0], seps = _group(parts[0], monetary=monetary)
00211         decimal_point = localeconv()[monetary and 'mon_decimal_point'
00212                                               or 'decimal_point']
00213         formatted = decimal_point.join(parts)
00214         if seps:
00215             formatted = _strip_padding(formatted, seps)
00216     elif percent[-1] in 'diu':
00217         seps = 0
00218         if grouping:
00219             formatted, seps = _group(formatted, monetary=monetary)
00220         if seps:
00221             formatted = _strip_padding(formatted, seps)
00222     return formatted

Here is the call graph for this function:

Here is the caller graph for this function:

def locale._group (   s,
  monetary = False 
) [private]

Definition at line 139 of file locale.py.

00139 
00140 def _group(s, monetary=False):
00141     conv = localeconv()
00142     thousands_sep = conv[monetary and 'mon_thousands_sep' or 'thousands_sep']
00143     grouping = conv[monetary and 'mon_grouping' or 'grouping']
00144     if not grouping:
00145         return (s, 0)
00146     result = ""
00147     seps = 0
00148     if s[-1] == ' ':
00149         stripped = s.rstrip()
00150         right_spaces = s[len(stripped):]
00151         s = stripped
00152     else:
00153         right_spaces = ''
00154     left_spaces = ''
00155     groups = []
00156     for interval in _grouping_intervals(grouping):
00157         if not s or s[-1] not in "0123456789":
00158             # only non-digit characters remain (sign, spaces)
00159             left_spaces = s
00160             s = ''
00161             break
00162         groups.append(s[-interval:])
00163         s = s[:-interval]
00164     if s:
00165         groups.append(s)
00166     groups.reverse()
00167     return (
00168         left_spaces + thousands_sep.join(groups) + right_spaces,
00169         len(thousands_sep) * (len(groups) - 1)
00170     )
00171 
# Strip a given amount of excess padding from the given string

Here is the call graph for this function:

Here is the caller graph for this function:

def locale._grouping_intervals (   grouping) [private]

Number formatting APIs.

Definition at line 123 of file locale.py.

00123 
00124 def _grouping_intervals(grouping):
00125     last_interval = None
00126     for interval in grouping:
00127         # if grouping is -1, we are done
00128         if interval == CHAR_MAX:
00129             return
00130         # 0: re-use last group ad infinitum
00131         if interval == 0:
00132             if last_interval is None:
00133                 raise ValueError("invalid grouping")
00134             while True:
00135                 yield last_interval
00136         yield interval
00137         last_interval = interval
00138 
#perform the grouping from right to left

Here is the caller graph for this function:

def locale._parse_localename (   localename) [private]
Parses the locale code for localename and returns the
    result as tuple (language code, encoding).

    The localename is normalized and passed through the locale
    alias engine. A ValueError is raised in case the locale name
    cannot be parsed.

    The language code corresponds to RFC 1766.  code and encoding
    can be None in case the values cannot be determined or are
    unknown to this implementation.

Definition at line 407 of file locale.py.

00407 
00408 def _parse_localename(localename):
00409 
00410     """ Parses the locale code for localename and returns the
00411         result as tuple (language code, encoding).
00412 
00413         The localename is normalized and passed through the locale
00414         alias engine. A ValueError is raised in case the locale name
00415         cannot be parsed.
00416 
00417         The language code corresponds to RFC 1766.  code and encoding
00418         can be None in case the values cannot be determined or are
00419         unknown to this implementation.
00420 
00421     """
00422     code = normalize(localename)
00423     if '@' in code:
00424         # Deal with locale modifiers
00425         code, modifier = code.split('@')
00426         if modifier == 'euro' and '.' not in code:
00427             # Assume Latin-9 for @euro locales. This is bogus,
00428             # since some systems may use other encodings for these
00429             # locales. Also, we ignore other modifiers.
00430             return code, 'iso-8859-15'
00431 
00432     if '.' in code:
00433         return tuple(code.split('.')[:2])
00434     elif code == 'C':
00435         return None, None
00436     raise ValueError('unknown locale: %s' % localename)

Here is the call graph for this function:

Here is the caller graph for this function:

def locale._print_locale ( ) [private]
Test function.

Definition at line 1817 of file locale.py.

01817 
01818 def _print_locale():
01819 
01820     """ Test function.
01821     """
01822     categories = {}
01823     def _init_categories(categories=categories):
01824         for k,v in globals().items():
01825             if k[:3] == 'LC_':
01826                 categories[k] = v
01827     _init_categories()
01828     del categories['LC_ALL']
01829 
01830     print('Locale defaults as determined by getdefaultlocale():')
01831     print('-'*72)
01832     lang, enc = getdefaultlocale()
01833     print('Language: ', lang or '(undefined)')
01834     print('Encoding: ', enc or '(undefined)')
01835     print()
01836 
01837     print('Locale settings on startup:')
01838     print('-'*72)
01839     for name,category in categories.items():
01840         print(name, '...')
01841         lang, enc = getlocale(category)
01842         print('   Language: ', lang or '(undefined)')
01843         print('   Encoding: ', enc or '(undefined)')
01844         print()
01845 
01846     print()
01847     print('Locale settings after calling resetlocale():')
01848     print('-'*72)
01849     resetlocale()
01850     for name,category in categories.items():
01851         print(name, '...')
01852         lang, enc = getlocale(category)
01853         print('   Language: ', lang or '(undefined)')
01854         print('   Encoding: ', enc or '(undefined)')
01855         print()
01856 
01857     try:
01858         setlocale(LC_ALL, "")
01859     except:
01860         print('NOTE:')
01861         print('setlocale(LC_ALL, "") does not support the default locale')
01862         print('given in the OS environment variables.')
01863     else:
01864         print()
01865         print('Locale settings after calling setlocale(LC_ALL, ""):')
01866         print('-'*72)
01867         for name,category in categories.items():
01868             print(name, '...')
01869             lang, enc = getlocale(category)
01870             print('   Language: ', lang or '(undefined)')
01871             print('   Encoding: ', enc or '(undefined)')
01872             print()

Here is the call graph for this function:

def locale._strcoll (   a,
  b 
) [private]
strcoll(string,string) -> int.
    Compares two strings according to the locale.

Definition at line 34 of file locale.py.

00034 
00035 def _strcoll(a,b):
00036     """ strcoll(string,string) -> int.
00037         Compares two strings according to the locale.
00038     """
00039     return (a > b) - (a < b)

def locale._strip_padding (   s,
  amount 
) [private]

Definition at line 172 of file locale.py.

00172 
00173 def _strip_padding(s, amount):
00174     lpos = 0
00175     while amount and s[lpos] == ' ':
00176         lpos += 1
00177         amount -= 1
00178     rpos = len(s) - 1
00179     while amount and s[rpos] == ' ':
00180         rpos -= 1
00181         amount -= 1
00182     return s[lpos:rpos+1]

Here is the caller graph for this function:

def locale._strxfrm (   s) [private]
strxfrm(string) -> string.
    Returns a string that behaves for cmp locale-aware.

Definition at line 40 of file locale.py.

00040 
00041 def _strxfrm(s):
00042     """ strxfrm(string) -> string.
00043         Returns a string that behaves for cmp locale-aware.
00044     """
00045     return s
00046 
00047 try:
00048 
00049     from _locale import *

def locale._test ( ) [private]

Definition at line 323 of file locale.py.

00323 
00324 def _test():
00325     setlocale(LC_ALL, "")
00326     #do grouping
00327     s1 = format("%d", 123456789,1)
00328     print(s1, "is", atoi(s1))
00329     #standard formatting
00330     s1 = str(3.14)
00331     print(s1, "is", atof(s1))

Here is the call graph for this function:

Here is the caller graph for this function:

def locale.atof (   string,
  func = float 
)

Definition at line 306 of file locale.py.

00306 
00307 def atof(string, func=float):
00308     "Parses a string as a float according to the locale settings."
00309     #First, get rid of the grouping
00310     ts = localeconv()['thousands_sep']
00311     if ts:
00312         string = string.replace(ts, '')
00313     #next, replace the decimal point with a dot
00314     dd = localeconv()['decimal_point']
00315     if dd:
00316         string = string.replace(dd, '.')
00317     #finally, parse the string
00318     return func(string)

Here is the call graph for this function:

Here is the caller graph for this function:

def locale.atoi (   str)

Definition at line 319 of file locale.py.

00319 
00320 def atoi(str):
00321     "Converts a string to an integer according to the locale settings."
00322     return atof(str, int)

Here is the call graph for this function:

Here is the caller graph for this function:

def locale.currency (   val,
  symbol = True,
  grouping = False,
  international = False 
)
Formats val according to the currency settings
in the current locale.

Definition at line 257 of file locale.py.

00257 
00258 def currency(val, symbol=True, grouping=False, international=False):
00259     """Formats val according to the currency settings
00260     in the current locale."""
00261     conv = localeconv()
00262 
00263     # check for illegal values
00264     digits = conv[international and 'int_frac_digits' or 'frac_digits']
00265     if digits == 127:
00266         raise ValueError("Currency formatting is not possible using "
00267                          "the 'C' locale.")
00268 
00269     s = format('%%.%if' % digits, abs(val), grouping, monetary=True)
00270     # '<' and '>' are markers if the sign must be inserted between symbol and value
00271     s = '<' + s + '>'
00272 
00273     if symbol:
00274         smb = conv[international and 'int_curr_symbol' or 'currency_symbol']
00275         precedes = conv[val<0 and 'n_cs_precedes' or 'p_cs_precedes']
00276         separated = conv[val<0 and 'n_sep_by_space' or 'p_sep_by_space']
00277 
00278         if precedes:
00279             s = smb + (separated and ' ' or '') + s
00280         else:
00281             s = s + (separated and ' ' or '') + smb
00282 
00283     sign_pos = conv[val<0 and 'n_sign_posn' or 'p_sign_posn']
00284     sign = conv[val<0 and 'negative_sign' or 'positive_sign']
00285 
00286     if sign_pos == 0:
00287         s = '(' + s + ')'
00288     elif sign_pos == 1:
00289         s = sign + s
00290     elif sign_pos == 2:
00291         s = s + sign
00292     elif sign_pos == 3:
00293         s = s.replace('<', sign)
00294     elif sign_pos == 4:
00295         s = s.replace('>', sign)
00296     else:
00297         # the default if nothing specified;
00298         # this should be the most fitting sign position
00299         s = sign + s
00300 
00301     return s.replace('<', '').replace('>', '')

Here is the call graph for this function:

Here is the caller graph for this function:

def locale.format (   percent,
  value,
  grouping = False,
  monetary = False,
  additional 
)
Returns the locale-aware substitution of a %? specifier
(percent).

additional is for format strings which contain one or more
'*' modifiers.

Definition at line 186 of file locale.py.

00186 
00187 def format(percent, value, grouping=False, monetary=False, *additional):
00188     """Returns the locale-aware substitution of a %? specifier
00189     (percent).
00190 
00191     additional is for format strings which contain one or more
00192     '*' modifiers."""
00193     # this is only for one-percent-specifier strings and this should be checked
00194     match = _percent_re.match(percent)
00195     if not match or len(match.group())!= len(percent):
00196         raise ValueError(("format() must be given exactly one %%char "
00197                          "format specifier, %s not valid") % repr(percent))
00198     return _format(percent, value, grouping, monetary, *additional)

Here is the call graph for this function:

Here is the caller graph for this function:

def locale.format_string (   f,
  val,
  grouping = False 
)
Formats a string in the same way that the % formatting would use,
but takes the current locale into account.
Grouping is applied if the third parameter is true.

Definition at line 223 of file locale.py.

00223 
00224 def format_string(f, val, grouping=False):
00225     """Formats a string in the same way that the % formatting would use,
00226     but takes the current locale into account.
00227     Grouping is applied if the third parameter is true."""
00228     percents = list(_percent_re.finditer(f))
00229     new_f = _percent_re.sub('%s', f)
00230 
00231     if isinstance(val, collections.Mapping):
00232         new_val = []
00233         for perc in percents:
00234             if perc.group()[-1]=='%':
00235                 new_val.append('%')
00236             else:
00237                 new_val.append(format(perc.group(), val, grouping))
00238     else:
00239         if not isinstance(val, tuple):
00240             val = (val,)
00241         new_val = []
00242         i = 0
00243         for perc in percents:
00244             if perc.group()[-1]=='%':
00245                 new_val.append('%')
00246             else:
00247                 starcount = perc.group('modifiers').count('*')
00248                 new_val.append(_format(perc.group(),
00249                                       val[i],
00250                                       grouping,
00251                                       False,
00252                                       *val[i+1:i+1+starcount]))
00253                 i += (1 + starcount)
00254     val = tuple(new_val)
00255 
00256     return new_f % val

Here is the call graph for this function:

Here is the caller graph for this function:

def locale.getdefaultlocale (   envvars = ('LC_ALL', 'LC_CTYPE',
  LANG,
  LANGUAGE 
)
Tries to determine the default locale settings and returns
    them as tuple (language code, encoding).

    According to POSIX, a program which has not called
    setlocale(LC_ALL, "") runs using the portable 'C' locale.
    Calling setlocale(LC_ALL, "") lets it use the default locale as
    defined by the LANG variable. Since we don't want to interfere
    with the current locale setting we thus emulate the behavior
    in the way described above.

    To maintain compatibility with other platforms, not only the
    LANG variable is tested, but a list of variables given as
    envvars parameter. The first found to be defined will be
    used. envvars defaults to the search path used in GNU gettext;
    it must always contain the variable name 'LANG'.

    Except for the code 'C', the language code corresponds to RFC
    1766.  code and encoding can be None in case the values cannot
    be determined.

Definition at line 453 of file locale.py.

00453 
00454 def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
00455 
00456     """ Tries to determine the default locale settings and returns
00457         them as tuple (language code, encoding).
00458 
00459         According to POSIX, a program which has not called
00460         setlocale(LC_ALL, "") runs using the portable 'C' locale.
00461         Calling setlocale(LC_ALL, "") lets it use the default locale as
00462         defined by the LANG variable. Since we don't want to interfere
00463         with the current locale setting we thus emulate the behavior
00464         in the way described above.
00465 
00466         To maintain compatibility with other platforms, not only the
00467         LANG variable is tested, but a list of variables given as
00468         envvars parameter. The first found to be defined will be
00469         used. envvars defaults to the search path used in GNU gettext;
00470         it must always contain the variable name 'LANG'.
00471 
00472         Except for the code 'C', the language code corresponds to RFC
00473         1766.  code and encoding can be None in case the values cannot
00474         be determined.
00475 
00476     """
00477 
00478     try:
00479         # check if it's supported by the _locale module
00480         import _locale
00481         code, encoding = _locale._getdefaultlocale()
00482     except (ImportError, AttributeError):
00483         pass
00484     else:
00485         # make sure the code/encoding values are valid
00486         if sys.platform == "win32" and code and code[:2] == "0x":
00487             # map windows language identifier to language name
00488             code = windows_locale.get(int(code, 0))
00489         # ...add other platform-specific processing here, if
00490         # necessary...
00491         return code, encoding
00492 
00493     # fall back on POSIX behaviour
00494     import os
00495     lookup = os.environ.get
00496     for variable in envvars:
00497         localename = lookup(variable,None)
00498         if localename:
00499             if variable == 'LANGUAGE':
00500                 localename = localename.split(':')[0]
00501             break
00502     else:
00503         localename = 'C'
00504     return _parse_localename(localename)
00505 

Here is the call graph for this function:

Here is the caller graph for this function:

def locale.getlocale (   category = LC_CTYPE)
Returns the current setting for the given locale category as
    tuple (language code, encoding).

    category may be one of the LC_* value except LC_ALL. It
    defaults to LC_CTYPE.

    Except for the code 'C', the language code corresponds to RFC
    1766.  code and encoding can be None in case the values cannot
    be determined.

Definition at line 506 of file locale.py.

00506 
00507 def getlocale(category=LC_CTYPE):
00508 
00509     """ Returns the current setting for the given locale category as
00510         tuple (language code, encoding).
00511 
00512         category may be one of the LC_* value except LC_ALL. It
00513         defaults to LC_CTYPE.
00514 
00515         Except for the code 'C', the language code corresponds to RFC
00516         1766.  code and encoding can be None in case the values cannot
00517         be determined.
00518 
00519     """
00520     localename = _setlocale(category)
00521     if category == LC_ALL and ';' in localename:
00522         raise TypeError('category LC_ALL is not supported')
00523     return _parse_localename(localename)

Here is the call graph for this function:

Here is the caller graph for this function:

def locale.getpreferredencoding (   do_setlocale = True)
Return the charset that the user is likely using.
Return the charset that the user is likely using,
by looking at environment variables.
Return the charset that the user is likely using,
according to the system configuration.

Definition at line 552 of file locale.py.

00552 
00553     def getpreferredencoding(do_setlocale = True):
00554         """Return the charset that the user is likely using."""
00555         import _locale
00556         return _locale._getdefaultlocale()[1]
else:

Here is the call graph for this function:

Here is the caller graph for this function:

localeconv() -> dict.
    Returns numeric and monetary locale-specific parameters.

Definition at line 64 of file locale.py.

00064 
00065     def localeconv():
00066         """ localeconv() -> dict.
00067             Returns numeric and monetary locale-specific parameters.
00068         """
00069         # 'C' locale default values
00070         return {'grouping': [127],
00071                 'currency_symbol': '',
00072                 'n_sign_posn': 127,
00073                 'p_cs_precedes': 127,
00074                 'n_cs_precedes': 127,
00075                 'mon_grouping': [],
00076                 'n_sep_by_space': 127,
00077                 'decimal_point': '.',
00078                 'negative_sign': '',
00079                 'positive_sign': '',
00080                 'p_sep_by_space': 127,
00081                 'int_curr_symbol': '',
00082                 'p_sign_posn': 127,
00083                 'thousands_sep': '',
00084                 'mon_thousands_sep': '',
00085                 'frac_digits': 127,
00086                 'mon_decimal_point': '',
00087                 'int_frac_digits': 127}

Here is the caller graph for this function:

def locale.normalize (   localename)
Returns a normalized locale code for the given locale
    name.

    The returned locale code is formatted for use with
    setlocale().

    If normalization fails, the original name is returned
    unchanged.

    If the given encoding is not known, the function defaults to
    the default encoding for the locale code just like setlocale()
    does.

Definition at line 341 of file locale.py.

00341 
00342 def normalize(localename):
00343 
00344     """ Returns a normalized locale code for the given locale
00345         name.
00346 
00347         The returned locale code is formatted for use with
00348         setlocale().
00349 
00350         If normalization fails, the original name is returned
00351         unchanged.
00352 
00353         If the given encoding is not known, the function defaults to
00354         the default encoding for the locale code just like setlocale()
00355         does.
00356 
00357     """
00358     # Normalize the locale name and extract the encoding
00359     fullname = localename.lower()
00360     if ':' in fullname:
00361         # ':' is sometimes used as encoding delimiter.
00362         fullname = fullname.replace(':', '.')
00363     if '.' in fullname:
00364         langname, encoding = fullname.split('.')[:2]
00365         fullname = langname + '.' + encoding
00366     else:
00367         langname = fullname
00368         encoding = ''
00369 
00370     # First lookup: fullname (possibly with encoding)
00371     norm_encoding = encoding.replace('-', '')
00372     norm_encoding = norm_encoding.replace('_', '')
00373     lookup_name = langname + '.' + encoding
00374     code = locale_alias.get(lookup_name, None)
00375     if code is not None:
00376         return code
00377     #print 'first lookup failed'
00378 
00379     # Second try: langname (without encoding)
00380     code = locale_alias.get(langname, None)
00381     if code is not None:
00382         #print 'langname lookup succeeded'
00383         if '.' in code:
00384             langname, defenc = code.split('.')
00385         else:
00386             langname = code
00387             defenc = ''
00388         if encoding:
00389             # Convert the encoding to a C lib compatible encoding string
00390             norm_encoding = encodings.normalize_encoding(encoding)
00391             #print 'norm encoding: %r' % norm_encoding
00392             norm_encoding = encodings.aliases.aliases.get(norm_encoding,
00393                                                           norm_encoding)
00394             #print 'aliased encoding: %r' % norm_encoding
00395             encoding = locale_encoding_alias.get(norm_encoding,
00396                                                  norm_encoding)
00397         else:
00398             encoding = defenc
00399         #print 'found encoding %r' % encoding
00400         if encoding:
00401             return langname + '.' + encoding
00402         else:
00403             return langname
00404 
00405     else:
00406         return localename

Here is the call graph for this function:

Here is the caller graph for this function:

def locale.resetlocale (   category = LC_ALL)
Sets the locale for category to the default setting.

    The default setting is determined by calling
    getdefaultlocale(). category defaults to LC_ALL.

Definition at line 540 of file locale.py.

00540 
00541 def resetlocale(category=LC_ALL):
00542 
00543     """ Sets the locale for category to the default setting.
00544 
00545         The default setting is determined by calling
00546         getdefaultlocale(). category defaults to LC_ALL.
00547 
00548     """
00549     _setlocale(category, _build_localename(getdefaultlocale()))

Here is the call graph for this function:

Here is the caller graph for this function:

def locale.setlocale (   category,
  locale = None 
)
setlocale(integer,string=None) -> string.
    Activates/queries locale processing.
Set the locale for the given category.  The locale can be
    a string, a locale tuple (language code, encoding), or None.

    Locale tuples are converted to strings the locale aliasing
    engine.  Locale strings are passed directly to the C lib.

    category may be given as one of the LC_* values.

Definition at line 88 of file locale.py.

00088 
00089     def setlocale(category, value=None):
00090         """ setlocale(integer,string=None) -> string.
00091             Activates/queries locale processing.
00092         """
00093         if value not in (None, '', 'C'):
00094             raise Error('_locale emulation only supports "C" locale')
00095         return 'C'
00096 
# These may or may not exist in _locale, so be sure to set them.

Here is the caller graph for this function:

def locale.str (   val)
Convert float to integer, taking the locale into account.

Definition at line 302 of file locale.py.

00302 
00303 def str(val):
00304     """Convert float to integer, taking the locale into account."""
00305     return format("%.12g", val)

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Initial value:
00001 ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error",
00002            "setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm",
00003            "str", "atof", "atoi", "format", "format_string", "currency",
00004            "normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY",
00005            "LC_NUMERIC", "LC_ALL", "CHAR_MAX"]

Definition at line 28 of file locale.py.

Definition at line 103 of file locale.py.

Definition at line 107 of file locale.py.

Initial value:
00001 re.compile(r'%(?:\((?P<key>.*?)\))?'
00002                          r'(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]')

Definition at line 183 of file locale.py.

Locale name aliasing engine.

Definition at line 339 of file locale.py.

Definition at line 54 of file locale.py.

locale.Error = ValueError

Definition at line 62 of file locale.py.

Definition at line 55 of file locale.py.

Definition at line 56 of file locale.py.

Definition at line 57 of file locale.py.

Definition at line 58 of file locale.py.

Definition at line 59 of file locale.py.

Definition at line 60 of file locale.py.

Definition at line 61 of file locale.py.

Definition at line 744 of file locale.py.

Database.

The following data was extracted from the locale.alias file which comes with X11 and then hand edited removing the explicit encoding definitions and adding some more aliases. The file is usually available as /usr/lib/X11/locale/locale.alias.

Definition at line 613 of file locale.py.

Definition at line 100 of file locale.py.

Definition at line 98 of file locale.py.

Definition at line 1604 of file locale.py.