-
Notifications
You must be signed in to change notification settings - Fork 14k
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
Support for Persian (fa) language #29509
Comments
Hey, @CodeWithEmad! I'm here to assist you with your issue. Let's work together to figure this out! 🤖 The error Here are the steps to ensure your Persian language pack is correctly set up:
By following these steps, you should be able to resolve the |
This is so cool, @dosu. the {
"domain": "superset",
"locale_data": {
"superset": {
"22": [""],
"": {
"domain": "superset",
"plural_forms": "nplurals=2; plural=(n==0 || n==1);",
"lang": "fa"
}, No, I didn't have |
To resolve the issue, ensure the following steps are correctly implemented:
By following these steps, you should be able to resolve the |
didn't solve my issue. |
Sorry to bother you here @rusackas. I followed the documentation but encountered this error. Did I miss a step? Maybe there's a limitation for some languages? I should mention that Persian is a right-to-left (RTL) language, but I just wanted to see the changes in the UI. |
All good. As you've surmised, these are indeed the best/current instructions. As for possibly missing a step here, did you do these two as well? I wonder if you can compare the resulting .json files with other languages, and see if there are any differences. Or even run it through GPT/Claude/AI and have it look for anything wrong. You might also open the Persian .po file using Poedit and see if there are any warnings/errors visible there. If you're getting any visible errors, those might be worth sharing here as well. |
Thanks for the response, @rusackas .
Yes, both
I'm using PoEdit. No warnings/errors on save. (I haven't translated everything yet. can it be that?) I compared jsons for Something is not right here. in the login screen, there's this message: "Enter your login and password below:", but I can't find it anywhere in the codebase. neither it's French translations: "Entrez votre login et mot de passe:" Update Update 2 Traceback (most recent call last):
File "/tmp/superset/.venv/bin/pybabel", line 8, in <module>
sys.exit(main())
File "/tmp/superset/.venv/lib/python3.10/site-packages/babel/messages/frontend.py", line 929, in main
return CommandLineInterface().run(sys.argv)
File "/tmp/superset/.venv/lib/python3.10/site-packages/babel/messages/frontend.py", line 853, in run
return cmdinst.run()
File "/tmp/superset/.venv/lib/python3.10/site-packages/babel/messages/frontend.py", line 481, in run
for filename, lineno, message, comments, context in extracted:
File "/tmp/superset/.venv/lib/python3.10/site-packages/babel/messages/extract.py", line 149, in extract_from_dir
for message_tuple in check_and_call_extract_file(
File "/tmp/superset/.venv/lib/python3.10/site-packages/babel/messages/extract.py", line 207, in check_and_call_extract_file
for message_tuple in extract_from_file(
File "/tmp/superset/.venv/lib/python3.10/site-packages/babel/messages/extract.py", line 243, in extract_from_file
return list(extract(method, fileobj, keywords, comment_tags,
File "/tmp/superset/.venv/lib/python3.10/site-packages/babel/messages/extract.py", line 320, in extract
raise ValueError('Unknown extraction method %r' % method)
ValueError: Unknown extraction method 'jinja2' I'll create #29548 for this issue |
Thanks for the dependency PR! I'm not sure about the strings for the login scree, but I would guess those are implemented in Flask-AppBuilder (FAB) and just don't have the Otherwise, it's not yet clear to me what the PR is. If you want to open a draft PR, maybe we can see what (if anything) fails when I pull/run it. |
Sorry, I shared a lot of details in one comment! About the Persian translations and Jed issue, I found no workarounds yet. I did everything step by step, but no luck. If it's not too much to ask, can you confirm that following the steps works for any language (like Following the "Creating new language directory" I found another issue. The script fails in a fresh virtual environment where Jinja2 is not installed. I've added it in #29548 |
Thanks for the (now merged) PR, that helps a bunch! Indeed, those steps should work for any language. As far as the Right to Left (RTL) situation, there was someone who was proposing to do some CSS/template tweaks to support Arabic, but I'm not sure if their effort went anywhere. We should track that down and see if anything took shape :)
That shouldn't be an issue. Most of our translations are partial, so this wouldn't be unusual.
I was able to confirm that these strings are part of a view in FAB. @dpgaspar might have a good means to rectify this, but the solutions that spring to mind are (1) we should make this view a part of our React Single Page App at some point, and (2) in the meantime, we can probably override the FAB jinja template with one in Superset, and then provide our own translations in any/all supported languages. |
Thanks for the extensive comment. I really appreciate it.
I'm out of ideas. My last guess is that probably something is wrong with my setup. Although, I did everything from scratch again. I don't mean to keep this open and can close it if you or someone can confirm the steps works for Persian.
Awesome. I found iasue #25258
Awesome man. Thanks. I'll try to find my way in that repo for login page translations but I love the idea of overriding the template. |
If you want to open a draft PR with the code you have, maybe I can pull the branch and see if my luck is any different. Side note, thank you for all the PRs you've opened thus far. Community contributions like this mean everything :D |
That's so nice of you. well, it's not much of a change, just a
Indeed, I love open source. I'm currently contributing to the openedx project and its related repositories, but I'm starting to like Superset. Maybe one day I can review pull requests. :) |
Hi!, @CodeWithEmad am facing the same problem that you describe at the beginning, I follow all the steps in the documentation but at the end of the day I am facing the following error Even if I delete the entire translations folder it still works for some languages so I suspect that it is not taking the translations from the translations folder but they are predefined somewhere else. I can't figure out if you found a solution, but if you have a solution I would appreciate it if you could help me. |
Hi @tsator. Sorry to hear this. Actually, it was fixed after I rebuilt the project. To generate the JSON files, navigate to the |
Bug description
Hi. I wanted to start translating for the Persian language on the project. As mentioned here, I created the language directory, added translations, built it for the frontend, and added it to
superset_configs.py
but frontend crashes when changing the language to Persian.How to reproduce the bug
I've created fa directory using:
pybabel init -i superset/translations/messages.pot -d superset/translations -l fa
and started translating some strings. then I
build-translations
for the forntend and then, addedinside
superset_config.py
and as I expected, I saw the English, French, and Persian languages, and English and French work fine, but after clicking on the Persian language, the frontend raises an error and the top bar doesn't render.This the error in in console
Screenshots/recordings
superset-frontend-error.mp4
Superset version
master / latest-dev
Python version
3.10
Node version
18 or greater
Browser
Chrome
Additional context
I've checked the superset logs. nothing weird is happening in the logs.
Checklist
The text was updated successfully, but these errors were encountered: