Babel does not translate in python but in JavaScript it is fine


I am still using a babel translation successfully in the JavaScript UI part of my plugin and like to add translations also to my python backend. I added everything like described here (as also still done for Jinja and JavaScript) but it does not translate the text. The translation itself is available in messages.po and also GETTEXT is used but it is still not translated. Any ideas what I forgot? Checked other plugins but did not find anything there...


Did you rebuild the language and re-install in OP? I haven't done much with translations but know there are steps you have to take for it to be filled in.

Not in OctoPrint...I done it in my plugin. Tried to change another text in JavaScript implementation which changes the translation correctly. Only python translation does not work it necessary to add it to OctoPrints central translation if I like to translate python messages in plugins?

The of all plugins including mine is read and merged by OctoPrint so I can use my local plugins translation. But if gettext is executed the context in Babel code is empty and it runs into NullTranslations. So it seems that I missed something to configure? Languages packages does not show any plugin with a translation packages...but do not know if this is necessary for the translation included in the plugin.

I think its a bug in OctoPrint itself. All translations in python does not work anymore. I created a bug for that: Babel translation seems not working anymore in python code · Issue #4626 · OctoPrint/OctoPrint · GitHub

I've replied on GitHub with what I think is the explanation for the translations not working, because there is no context.