translations.strings module

Provides translation functionality.

class translations.strings.LangStrings(infile, encoding='utf_8')[source]

Bases: dict

Dictionary class used to store all strings for a plugin.

__init__(infile, encoding='utf_8')[source]

Add all strings and fix double escaped strings.

get_strings(key, **tokens)[source]

Return a TranslationStrings object with updated tokens.

class translations.strings.TranslationStrings[source]

Bases: dict

Stores and get language strings for a particular string.


Store an empty dictionary as the tokens.


Return the language to be used.

get_string(language=None, **tokens)[source]

Return the language string for the given language/tokens.


Create a new TranslationStrings instance and store tokens in it.

Parameters:tokens (dict) – Tokens to store in the instance.
Returns:New TranslationStrings instance with tokens stored in it.
Return type:TranslationStrings