-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Start adding multi-language support #38
base: main
Are you sure you want to change the base?
feat: Start adding multi-language support #38
Conversation
Start introducing 'gettext' on dashboard and variables to traslate the name expose on the streamlit interface, add also files to translate from english to german, remove line on '.gitignore' file to not ignore translation files fix jfreissmann#7
Hi @zarch, interesting approach you suggest (I have just seen this as I opened my PR, so I thought I'd jump on it). I have read a little bit about the streamlit and gettext approaches (https://readmedium.com/how-to-build-a-multi-language-dashboard-with-streamlit-9bc087dd4243). What I find a little bit strange, is the fact that apparently you have to regenerate the files in case the code changes? Or does that happen automatically? Best Francesco |
Hi @fwitte ,
I'm not an expert on translation, but from other projects that I've seen, every time that a message So to answer to your question, it is possible to automatically update/generate the template using a tool and command like: $ pygettext3.12 -d base -o locales/dashboard.pot src/heatpumps/hp_dashboard.py However, for each $ msgfmt -o locales/de/LC_MESSAGES/dashboard.mo locales/de/LC_MESSAGES/dashboard.po To me this process/check should be performed before a release, I do not know if there are any github actions that perform these kind of checks automatically. A project that I follow grass use weblate that, in case of grass is self-hosted on OSGeo. |
thank you for your proposals regarding this issue. We are very glad to welcome anyone who wants to help build great software. My first instinct to tackle this issue were dictionaries, but you are right that Two hints regarding the issues with your minimal example and the PR:
Best regards, |
Hi @jfreissmann , Thank you for your feedback.
I'm afraid that using a custom dictionary mechanism will not improve a lot.
More or less is what
I agree, the full workflow is not clear to me too 🤣
It is fine for me, I just found the project and I bring it into the discussion I have no strong opinion on that.
I saw the discussion but I was not able to understand how to apply on our case. Especially because I tried to build a minimum reproducible examples and it works... So I'm not sure that I properly understood where the problem is.
I'm aware of this and the current version is already dealing / removing / splitting the text to avoid this kind of issues. |
Full agreeance.
I think, a well documented workflow is necessary, but also sufficient to make the decision to move on and use
Sorry, i must have missed that between all the changes. My bad! |
Meanwhile, I think, I found the cause of the problem your PR is facing. The error occured in line 1025, which is preceeded by the creation of multiple columns (your line 1015), some of which are only used as padding and were therefore not needed in the further code. In accordance with best practices, we used the underscore # %% State Diagrams
col_left, _, col_right = st.columns([0.495, 0.01, 0.495])
_, slider_left, _, slider_right, _ = st.columns([0.5, 8, 1, 8, 0.5])
if is_dark:
state_diagram_style = "dark"
else:
state_diagram_style = "light"
with col_left:
# %% Log(p)-h-Diagram
st.subheader(_("Log(p)-h Diagram")) We could either rename these unused columns. On the other hand, streamlit now allows to pass a keyword argument to chose between a small, medium or large gap between columns. Maybe this option makes the use of padding columns obsolete. |
PR that tried to fix #7.
The main changes are:
The current state is not fully functional, in particular I had issues with
st.subheader
like for instance:If I change them to:
When I execute the code I get:
That I don't know exactly how to fix.
I tried to build a minimal example:
But if I run the code it works:
I'm not a streamlit expert do you have any idea suggestion on how should I fix this?