Open aprendizlaura opened 1 month ago
I found some similar issues and discussions that might help address the problems you're facing with language settings in Superset:
Partial and Incorrect Translations:
Language Configuration Not Saved:
"locale"
, defaulting to "en"
if not set. This means the language setting is not persistent across different sessions or browsers [4].Redirect to Homepage:
Partial and Incorrect Translations:
BABEL_DEFAULT_LOCALE
is set correctly and that the LANGUAGES
dictionary is populated with the supported languages and their respective flags and names..po
, .mo
, .json
) are correctly updated and placed in the appropriate directory.# Babel config for translations
BABEL_DEFAULT_LOCALE = "en"
BABEL_DEFAULT_FOLDER = "superset/translations"
LANGUAGES = {
"en": {"flag": "us", "name": "English"},
"es": {"flag": "es", "name": "Spanish"},
"it": {"flag": "it", "name": "Italian"},
"fr": {"flag": "fr", "name": "French"},
"zh": {"flag": "cn", "name": "Chinese"},
"zh_TW": {"flag": "tw", "name": "Traditional Chinese"},
"ja": {"flag": "jp", "name": "Japanese"},
"de": {"flag": "de", "name": "German"},
"pt": {"flag": "pt", "name": "Portuguese"},
"pt_BR": {"flag": "br", "name": "Brazilian Portuguese"},
"ru": {"flag": "ru", "name": "Russian"},
"ko": {"flag": "kr", "name": "Korean"},
"sk": {"flag": "sk", "name": "Slovak"},
"sl": {"flag": "si", "name": "Slovenian"},
"nl": {"flag": "nl", "name": "Dutch"},
"uk": {"flag": "uk", "name": "Ukranian"},
}
Language Configuration Not Saved:
Redirect to Homepage:
// Example: Retain current page after language change
$('#language-picker a').click(function (ev) {
ev.preventDefault();
SupersetClient.get({
url: ev.currentTarget.href,
parseMethod: null,
}).then(() => {
window.location.reload(true); // true to force reload from server
});
});
By implementing these changes, you can address the issues of partial and incorrect translations, unsaved language configurations, and homepage redirects in Superset.
To continue talking to Dosu, mention @dosu.
is this issue resolved?
@Suvendu-UI No, it hasn't been resolved. The issue that concerns me the most is the first one, and even with the configuration that Dosu suggested (which I already had because I read other threads), it still works partially.
Partial translations are not considered bugs, as we'll be chasing that down approximately forever. If you'd like to contribute or fix translations, we encourage you to edit the .po
files and open a PR with your changes.
I haven't looked much at the other two issues, but the second one sounds legit, and maybe you can set a cookie or use localstorage to resolve this. The third, I believe, is a duplicated of another open issue. If you or I find that, we might want to close this as a duplicate... I'd encourage you to file issues separately for reasons like this :)
@rusackas Great! I’ll keep that in mind for next time and present the issues separately. Since they all relate to a common theme, I thought it made sense to present them together, but now that you mention it, you’re absolutely right to address them separately. Going back to the topic of partial translations, it’s not really the main issue I see. The bigger problem, in my opinion, is incorrect translations. As I’ve attached in the image, you can see that for ascending and descending order, it shows the same text for both, in this case, descending order. I’ve found myself more than once having to change the language because the translation wasn’t correct. What I mean is, partial translations seem great to me, and actually, being in English right now seems the most optimal at this stage of the language development.
Thank you so much, as always, for your responses!
aprendizlaura I suggest this option, it suits me, maybe it will suit you too. This solves the problem with redirection and language change Add it to config.py:
class SupersetIndexView(IndexView):
@expose("/lang/<string:locale>")
def patch_flask_locale(self, locale):
from flask import redirect, request, session
referrer = request.headers.get("Referer")
session["locale"] = locale
return redirect(referrer)
FAB_INDEX_VIEW = f"{SupersetIndexView.__module__}.{SupersetIndexView.__name__}"
@aprendizlaura I have no idea how many incorrect translations there might be in Superset, but @mistercrunch and I are interested in making the experience of contributing/mantaining these translations easier.
We're trying to find ways for both people and AI to fill in the blanks and make corrections, so we hope to follow up there in the future. For now, if you're able to open a PR with these changes (just find the string and change it in the relevant .po
file) that would be helpful and appreciated.
I am experiencing multiple issues related to the language settings in Superset: