Documentation of the api

class pylocwolowitz.core.Pylocwolowitz(path, format_deserializer='json', default_key=None)[source]

Pylocwolitz is a very simple text localization system.

Pylocwolitz is a very simple text localization system, meant to be used by web applications (but can pretty much be used anywhere). Yes, another localization system.

Parameters:
  • path (str) – File path translation
  • format_deserializer (str) – Indicate the serializer to use json or yaml
  • default_key (str) – Specify a default key if the key is not found
Raises:

ValueError – Format not supported, only json or yaml.

loc(key, lang, values=None)[source]

Get the translate.

Return the string key, translated to the requested language (if such a translation exists, otherwise no traslation occurs). Any other parameters passed to the method are injected to the placeholders in the string (if present).

Parameters:
  • key (str) – Key translate
  • lang (str) – Language to translate
  • values (dict) – Arguments are injected to the placeholders in the string
Returns:

Translated to the requested language

Return type:

str