flare.i18n

Internationalization tools to easily implement multi-language applications.

Module Contents

Functions

buildTranslations(pathToFolder)

translate(key[, fallback])

Tries to translate the given string in the currently selected language.

addTranslation(lang, a[, b])

Adds or updates new translations.

setLanguage(lang)

Sets the current language to lang.

getLanguage()

Returns the current language.

Attributes

_currentLanguage

_currentLanguage

_currentLanguage

_currentLanguage

_runtimeTranslations

_lngMap

flare.i18n._currentLanguage
flare.i18n._currentLanguage
flare.i18n._currentLanguage = en
flare.i18n._currentLanguage
flare.i18n._runtimeTranslations
flare.i18n._lngMap
flare.i18n.buildTranslations(pathToFolder)
flare.i18n.translate(key, fallback=None, **kwargs)

Tries to translate the given string in the currently selected language.

Supports replacing markers (using {markerName} syntax).

Parameters
  • key – The string to translate

  • fallback – Return string when no translation is found.

Returns

The translated string

flare.i18n.addTranslation(lang, a, b=None)

Adds or updates new translations.

flare.i18n.setLanguage(lang)

Sets the current language to lang.

flare.i18n.getLanguage()

Returns the current language.