This question was already asked but with no answer .
My app deploys as an english app and user brower partialy translates some words to french giving funny results
How to I set lang to french ?.
This question was already asked but with no answer .
My app deploys as an english app and user brower partialy translates some words to french giving funny results
How to I set lang to french ?.
Hi @Boubil_Nat
To work with HTML codes, you’ll need to activate unsafe_allow_html=True
parameter in st.markdown
.
As for translation, it seems to be a browser translation. Other options could be actual translation of the underlying text. Or the use of a language translation library that translates text used in-app.
Then lang attribute has to be set on the tag which cannot be done with st.markdown
.
Hi @Boubil_Nat
Perhaps you can look into CSS customization which uses st.markdown()
.
input_css = """
... css code goes here ...
"""
st.markdown(f'<style>{input_css}</style>', unsafe_allow_html=True)
I’m having the same problem on my app, using Spanish language, the browsers keep trying to translate to english. Is there any way to change headers or only the lang of the app?
Same problem here.
I found a solution, but it’s not exactly user friendly.
You can directly change HTML code in streamlit library.
If it is installed in the venv (virtual environment), the file you need is located at the path:
Windows: “venv\Lib\site-packages\streamlit\static\index.html
”.
Linux with python3.11: “venv/lib/python3.11/site-packages/streamlit/static/index.html
”.
This file has all the content wrapping of the page. html, head, and body tags.
There you can specify the necessary parameters for these tags or add your own tags.
Please note that this is not the best solution, because when you update streamlit library - you will have to change all these HTML parameters in venv again.
But this is the only working solution that I could find.
P.S. For Streamlit developers: Please add an option to specify page language. Visitors of my site complain that the site is displayed incorrectly and shows errors. Because their browser automatically translates the page, including material icons.
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.