A lightweight library specialized in convenient localization (i18n).
Via uv (recommended):
uv pip install vesna— Minimaluv pip install vesna[all]— Full
Via pip:
python -m pip install vesna— Minimalpython -m pip install vesna[all]— Full
import vesna
async def main():
await vesna.i18n.load_file(
vesna.providers.ProviderJSON(), "uk", "tests/localisation/{locale_code}.json"
)
l = vesna.Locale("uk")
print(l["vesna"])
print(l("hello", l.get("world")))- Support for multiple localization formats
- Convenient syntax with
[]and()support Babelintegration
FluentProvider: Fluent format (requiresfluent.runtime).GettextProvider: GNU Gettext format (requiresBabel).ProviderJSON: JSON format (usespydantic_core, requirespydantic).ProviderJSON5: JSON5 format (requiresjson5orpyjson5).ProviderHJSON: HJSON format (requireshjson).ProviderTOML: TOML format (requiresrtoml).ProviderYAML: YAML format (requiresruamel.yaml).
import vesna
v = vesna.Vesna()
# Set as the global default object
v.default_object = vThis project is licensed under the MIT License. See the LICENSE file for details.