dotkey-i18n: Lightweight Python Library Offers JSON-Based i18n Without gettext
A Python developer has released dotkey-i18n, a dependency-free internationalization library designed as a simpler alternative to gettext and Babel for small to medium applications. The library uses plain JSON files for translations, with dot notation keys that map to nested objects, making them easy for anyone to edit. It includes built-in fallback to a default language when a translation key is missing, and handles errors gracefully by returning the key itself rather than crashing the interface. Language detection is handled via an injectable lang_getter, making the library compatible with frameworks like Flask, FastAPI, and NiceGUI. The package originated from a bilingual report management system and is available on PyPI and GitHub.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in