Skip to content

globals

Variables

Functions

set_language

Override the locale language.

Parameters

NameTypeDescription
langstrThe lang to use.

get_language

Returns the configured language code

init

Load lang file from the directory path.

Parameters

NameTypeDefaultDescription
pathstrDirectory path to the .lang files
defaultstren_USThe default lang file to use if the locale lang does not exist.

translate

Use the root translator.

Parameters

NameTypeDefaultDescription
keystrThe key to translate
subsList of values to substitute. These can either be ordered (%1, %2, etc.) or not ordered (%s)
fallbackstrNoneThe fallback text if key can't be found. Returns key by default.

dump

Serialize obj as a LANG formatted stream to fp (a .write()-supporting file-like object).

Parameters

NameTypeDescription
objLang or dictThe object to serialize
fpstrThe file-like object

dumps

Serialize obj to a LANG formatted str.

Parameters

NameTypeDescription
objLang or dictThe object to serialize

load

Deserialize fp (a .read()-supporting file-like object containing a LANG document) to a Python object.

Parameters

NameTypeDescription
fpstr or bytesThe file-like object to deserialize

loads

Deserialize s (a str, bytes or bytearray instance containing a LANG document) to a Python object.

Parameters

NameTypeDescription
sstr, bytes, or bytearrayThe str, bytes, or bytearray to deserialize

Not associated with or approved by Mojang Studios or Microsoft