locale
index
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py
Module Docs

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.

 
Modules
       
encodings
functools
operator
re
sys

 
Classes
       
exceptions.Exception(exceptions.BaseException)
Error

 
class Error(exceptions.Exception)
    
Method resolution order:
Error
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
Functions
       
atof(string, func=<type 'float'>)
Parses a string as a float according to the locale settings.
atoi(str)
Converts a string to an integer according to the locale settings.
currency(val, symbol=True, grouping=False, international=False)
Formats val according to the currency settings
in the current 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.
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.
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.
getlocale(category=2)
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.
getpreferredencoding(do_setlocale=True)
Return the charset that the user is likely using,
according to the system configuration.
localeconv()
() -> dict. Returns numeric and monetary locale-specific parameters.
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.
resetlocale(category=0)
Sets the locale for category to the default setting.
 
The default setting is determined by calling
getdefaultlocale(). category defaults to LC_ALL.
setlocale(category, locale=None)
Set the locale for the given category.  The locale can be
a string, an iterable of two strings (language code and encoding),
or None.
 
Iterables are converted to strings using the locale aliasing
engine.  Locale strings are passed directly to the C lib.
 
category may be given as one of the LC_* values.
str(val)
Convert float to integer, taking the locale into account.
strcoll(...)
string,string -> int. Compares two strings according to the locale.
strxfrm(...)
string -> string. Returns a string that behaves for cmp locale-aware.

 
Data
        CHAR_MAX = 127
LC_ALL = 0
LC_COLLATE = 1
LC_CTYPE = 2
LC_MESSAGES = 6
LC_MONETARY = 3
LC_NUMERIC = 4
LC_TIME = 5
__all__ = ['getlocale', 'getdefaultlocale', 'getpreferredencoding', 'Error', 'setlocale', 'resetlocale', 'localeconv', 'strcoll', 'strxfrm', 'str', 'atof', 'atoi', 'format', 'format_string', 'currency', 'normalize', 'LC_CTYPE', 'LC_COLLATE', 'LC_TIME', 'LC_MONETARY', ...]