简体   繁体   中英

Flask-Babel won't translate text on AWS within a docker container, but does locally

I have a flask app that is using flask-babel to translate text. I have created a docker container for it all to run in. And i have verified multiple times that both are being run and built exactly the same way.

When i put the app on my local docker container (using a vagrant linux machine). The translations work fine. When i put it on AWS, the translations do not work, and they simply show the msgid text. So things like "website_title" etc. instead of the correct localized text.

This is really weird to me because everything is running EXACTLY the same and inside of docker containers, so there shouldn't be anything different about them.

If needed i can post some code snippets with sensitive stuff edited out, but i was more hoping for someone to point me in a general direction on why this might be happening or how to even debug it. As far as i can tell there are no errors being logged anywhere.

I found the problem.

Locally i am running it on a vagrant virtual machine on a windows computer. It looks like because windows is not a case sensitive file system, when the python gettext() function was looking for en_US, i was passing it en_us, which it found on windows. But on AWS, it did not because it was running linux which is case sensitive.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM