How to build a multi language with Streamlit

Heys guys, I have just finished developing my streamlit app, a simple one in German language, now I will like to have a simple icon on top that can allow the user change the language, I only need two languages, English and German. How do you suggest I approach this, please?

A simple sample app would be beneficial.

Thank you so much!

1 Like

I was able to fix this by using python dictionary to map the languages. In case someone thinks about this in the future. cheers

2 Likes

can you give me a example code? thank you very much!

Hi, I recommend use Gettext to localize strings.

Here’s my article about using Gettext with Streamlit:
https://blog.devgenius.io/how-to-build-a-multi-language-dashboard-with-streamlit-9bc087dd4243

1 Like

Hi fischerbach, I’ve followed your tutorial and get to the stage where the command generate the .pot and .po files. The only issue I am stuck on is the generated .pot file does not include the string that I wrap the (_ wrapper on.

1 Like

Hey, were you able to resolve this? i am stuck in the exact same spot right now :confused: