Forums

Problems with Flask-babel

Hi, Im working on babies first website and im trying to implement nice translations with flask-babel. The issue is that they dont work when hosted. All is fine when I run locally, but live version only gets urls and links translated. The text is not. Heres a stacktrace ive got: http://pastebin.com/yf3xbgpU It only happend once tho. You can see the site here http://www.piotrjastrzebski.io/ When you select the language, urls change and the Play Store img but not other text. Im out of ideas, thanks!

The BuildError in the stack trace on pastebin looks like you don't have a url defined for trans_bp.index. Is that something that Flask-Babel provides? If it only happened once, it may be that it only happens when the app is restarted and the untranslated text is used as a fallback.

I also notice there's some threading stuff going on that may be related - threads are disabled in web apps so that may be the root cause. Is there an option to pre-generate translations in Flask-Babel to prevent the threading?

This is so infuriating. Ive made simple test app and it works as expected. Ill guess this will be decent blog post once I find the typo or whatever... http://evilentitytest.pythonanywhere.com

Yes, turns out it was an idiot mistake. I didnt add the translation map or whatever to git and didnt have it on the instance. So my translations didnt work. Im quite disapointet that there wasnt any warning about that...

Anyway the routing error is still there on first run. Perhaps it is some kind of threading problem. It doesnt impact the site from what i can tell.

Well, it's good that it's working now, anyway!

If the remaining error isn't affecting the site then perhaps it's OK. It would be know to see what's causing it, but I can't see anything obvious from a bit of googling...