On a project where I use Eel Python and you can tell Eel to use Jinja2.
Works fine (congrats to the creators). I installed Babel, created a /lang/ folder where I store .pot and .po and .mo files after extraction (using cli command, pybabel extract...), init of languages (pybabel ini) and finally compilation to get the .mo per language (pybabel compile).
In Eel init from babel.support I import Translations. I add i18n extension to the created Jinja Environement and I add translations Translations.load('lang', ['fr'])
in the install_gettext_translations
method of the Jinja Environnement.
Whatever I do my {% trans %}
tags, my _("here a text")
are not translated into the language I put. In babel.support class Translations, load method, if I track my parameters, the method gettext.find(dirname, locales...) always returns a None ??
I was wondering if I have to instanciate Babel - babel = Babel()
- somewhere so that my path /lang/ be registered ?
Or if I have to set this path somewhere but I haven't found where.
I read several chunks of the documentation (Babel and Jinja) but I am stuck.
There is smthg I am not doing right...
If anyone has a clue, I would appreciate.
Thanks.
I moved /lang/ into jinja templates folder
I tried relative and absolute path for the parameter dirname
Finally decided to dig into Babel. In babel.support class Translations, load method, if I track my parameters, the method gettext.find(dirname, locales...) always returns a None ??
In vain.