PyDocs

Internationalization

Internationalization

locale

Locale support module.

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.
Symbols in locale

a

ABDAY_1
Get the abbreviated name of the n-th day of the week.
ABDAY_2
Get the abbreviated name of the n-th day of the week.
ABDAY_3
Get the abbreviated name of the n-th day of the week.
ABDAY_4
Get the abbreviated name of the n-th day of the week.
ABDAY_5
Get the abbreviated name of the n-th day of the week.
ABDAY_6
Get the abbreviated name of the n-th day of the week.
ABDAY_7
Get the abbreviated name of the n-th day of the week.
ABMON_1
Get the abbreviated name of the n-th month.
ABMON_10
Get the abbreviated name of the n-th month.
ABMON_11
Get the abbreviated name of the n-th month.
ABMON_12
Get the abbreviated name of the n-th month.
ABMON_2
Get the abbreviated name of the n-th month.
ABMON_3
Get the abbreviated name of the n-th month.
ABMON_4
Get the abbreviated name of the n-th month.
ABMON_5
Get the abbreviated name of the n-th month.
ABMON_6
Get the abbreviated name of the n-th month.
ABMON_7
Get the abbreviated name of the n-th month.
ABMON_8
Get the abbreviated name of the n-th month.
ABMON_9
Get the abbreviated name of the n-th month.
ALT_DIGITS
Get a string consisting of up to 100 semicolon-separated symbols used to represent the values 0 to 99 in a locale-specific way.
atof
Parses a string as a float according to the locale settings.
atoi
Converts a string to an integer according to the locale settings.

b

bind_textdomain_codeset
Bind the C library's domain to codeset.
bindtextdomain
Bind the C library's domain to dir.

c

CHAR_MAX
This is a symbolic constant used for different values returned by localeconv().
CODESET
Get a string with the name of the character encoding used in the selected locale.
CRNCYSTR
Get the currency symbol, preceded by “-” if the symbol should appear before the value, “+” if the symbol should appear after the value, or “.” if the symbol should replace the radix character.
currency
Formats val according to the currency settings in the current locale.

d

D_FMT
Get a string that can be used as a format string for time.strftime() to represent a date in a locale-specific way.
D_T_FMT
Get a string that can be used as a format string for time.strftime() to represent date and time in a locale-specific way.
DAY_1
Get the name of the n-th day of the week.
DAY_2
Get the name of the n-th day of the week.
DAY_3
Get the name of the n-th day of the week.
DAY_4
Get the name of the n-th day of the week.
DAY_5
Get the name of the n-th day of the week.
DAY_6
Get the name of the n-th day of the week.
DAY_7
Get the name of the n-th day of the week.
dcgettext
Return translation of msg in domain and category.
delocalize
Parses a string as a normalized number according to the locale settings.
dgettext
Return translation of msg in domain.

e

ERA
Get a string which describes how years are counted and displayed for each era in a locale.
ERA_D_FMT
Get a format string for time.strftime() to represent a date in a locale-specific era-based way.
ERA_D_T_FMT
Get a format string for time.strftime() to represent date and time in a locale-specific era-based way.
ERA_T_FMT
Get a format string for time.strftime() to represent a time in a locale-specific era-based way.
Error
Exception raised when the locale passed to setlocale() is not recognized.

f

format_string
Formats a string in the same way that the % formatting would use, but takes the current locale into account.

g

getdefaultlocale
Tries to determine the default locale settings and returns them as tuple (language code, encoding).
getencoding
Get the current locale encoding.
getlocale
Returns the current setting for the given locale category as tuple (language code, encoding).
getpreferredencoding
Return the charset that the user is likely using, according to the system configuration.
gettext
Return translation of msg.

l

LC_ALL
Combination of all locale settings.
LC_COLLATE
Locale category for sorting strings.
LC_CTYPE
Locale category for the character type functions.
LC_MESSAGES
Locale category for message display.
LC_MONETARY
Locale category for formatting of monetary values.
LC_NUMERIC
Locale category for formatting numbers.
LC_TIME
Locale category for the formatting of time.
localeconv
Returns numeric and monetary locale-specific parameters.
localize
Parses a string as locale number according to the locale settings.

m

MON_1
Get the name of the n-th month.
MON_10
Get the name of the n-th month.
MON_11
Get the name of the n-th month.
MON_12
Get the name of the n-th month.
MON_2
Get the name of the n-th month.
MON_3
Get the name of the n-th month.
MON_4
Get the name of the n-th month.
MON_5
Get the name of the n-th month.
MON_6
Get the name of the n-th month.
MON_7
Get the name of the n-th month.
MON_8
Get the name of the n-th month.
MON_9
Get the name of the n-th month.

n

nl_langinfo
Return the value for the locale information associated with key.
NOEXPR
Get a regular expression that can be used with the regex(3) function to recognize a negative response to a yes/no question.
normalize
Returns a normalized locale code for the given locale name.

r

RADIXCHAR
Get the radix character (decimal dot, decimal comma, etc.).

s

setlocale
Set the locale for the given category.
str
Convert float to string, taking the locale into account.
strcoll
Compares two strings according to the locale.
strxfrm
Return a string that can be used as a key for locale-aware comparisons.

t

T_FMT
Get a string that can be used as a format string for time.strftime() to represent a time in a locale-specific way.
T_FMT_AMPM
Get a format string for time.strftime() to represent time in the am/pm format.
textdomain
Set the C library's textdmain to domain, returning the new domain.
THOUSEP
Get the separator character for thousands (groups of three digits).

y

YESEXPR
Get a regular expression that can be used with the regex function to recognize a positive response to a yes/no question.