iccas.i18n package¶
Submodules¶
iccas.i18n.lib module¶
A simple and crappy i18n library written “for fun” and because neither gettext and python-i18n were optimal for my use case which requires reloading of translations when a change is made without restarting the interpreter/kernel and possibly without reloading the module.
-
class
iccas.i18n.lib.
NullTranslation
[source]¶ Bases:
iccas.i18n.lib.Translation
-
class
iccas.i18n.lib.
TranslationFile
(path, content, last_modified)[source]¶ Bases:
object
-
content
: dict¶
-
last_modified
: int¶
-
path
: pathlib.Path¶
-
-
class
iccas.i18n.lib.
TranslationsManager
(*paths)[source]¶ Bases:
object
-
injector
(scoped_translations=None)[source]¶ Decorator that adds a
lang
argument to the signature and injects astrings
argument of typeTranslation
. If the translation files are modified, they are automatically reloaded.You can also pass extra translations as dict or YAML string to the wrapped function. Nonetheless, any modification will require to reload the module to take effect.
- Parameters
scoped_translations (
Union
[None
,str
,Mapping
[str
,Mapping
[str
,Union
[str
,Mapping
[str
,str
]]]]]) – yaml string or dictionary
-