languagemanager

The languagemanager module provides all the translation settings and language file loading for OpenLP.

class openlp.core.common.languagemanager.LanguageManager[source]

Bases: object

Helper for Language selection

auto_language = False
static find_qm_files()[source]

Find all available language files in this OpenLP install

static get_language()[source]

Retrieve a saved language to use from settings

static get_qm_list()[source]

Return the list of available translations

static get_translators(language)[source]

Set up a translator to use in this instance of OpenLP

Parameters:language – The language to load into the translator
static init_qm_list()[source]

Initialise the list of available translations

static language_name(qm_file)[source]

Load the language name from a language file

Parameters:qm_file – The file to obtain the name from
static set_language(action, message=True)[source]

Set the language to translate OpenLP into

Parameters:
  • action – The language menu option
  • message – Display the message option
openlp.core.common.languagemanager.format_time(text, local_time)[source]

Workaround for Python built-in time formatting function time.strftime().

time.strftime() accepts only ascii characters. This function accepts unicode string and passes individual % placeholders to time.strftime(). This ensures only ascii characters are passed to time.strftime().

Parameters:
  • text – The text to be processed.
  • local_time – The time to be used to add to the string. This is a time object
openlp.core.common.languagemanager.get_locale_key(string)[source]

Creates a key for case insensitive, locale aware string sorting.

Parameters:string – The corresponding string.
openlp.core.common.languagemanager.get_natural_key(string)[source]

Generate a key for locale aware natural string sorting.

Parameters:string – string to be sorted by

Returns a list of string compare keys and integers.