Search code examples
pythondockerlocalizationgettext

Can the GNU gettext module in Python fetch translations from cloud or from another container?


This is more of an structural architectural question. I am using Python gettext module to fetch translations. But the way it works, as described in the link as well, the translations have to be in the same repo and pod with the Python code so that the gettext module can find them in the local directory when the application is running.

The issue with this is that we have to update and redeploy the repo every time the translations change. Would it be possible for gettext module to fetch the translation from cloud storage or even better maybe from a different pod which is deployed independently from the application? Any suggestions on how I can separate the code from the translations?


Solution

  • This is not possible out of the box.

    But you can change the directory where .mo files are searched with gettext.bindtextdomain(). They don't have to be in the local directory, when the application is running.