[6.0.0rc4] i18n Fails in Embedded Dashboards Due to /language_pack/<lang>/ Auth Error
Bug description
I use the following code to set the correct locale:
def set_locale_from_url_param():
from flask import session, request
locale_param = request.args.get('lang')
if locale_param:
supported_locales = ['de', 'fr']
if locale_param in supported_locales:
session["locale"] = locale_param
FLASK_APP_MUTATOR = lambda app: app.before_request(set_locale_from_url_param)
That works fine, however, the call to language_pack/<lang>/ is unauthorized because the guest token is not set yet.
Screenshots/recordings
No response
Superset version
6.0.0rc4
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Hi @gerbermichi! I'm Dosu and I’m helping the superset team.
In Superset 6.0+, the /language_pack/<lang>/ endpoint is deprecated and no longer used for loading translations. Instead, language packs are bundled into the initial bootstrap data and injected into the frontend as part of the HTML payload. If your embedded dashboard is still trying to fetch /language_pack/<lang>/, it means the frontend isn't getting the language pack from the bootstrap data—often due to a mismatch between the session locale and the available language packs, or because the frontend build is out of sync with your config.
To fix this:
-
Make sure your frontend and backend are both running the standard 6.0+ codebase, and that you don't have any custom code or legacy logic trying to fetch
/language_pack/<lang>/reference. -
Use the
COMMON_BOOTSTRAP_OVERRIDES_FUNCin yoursuperset_config.pyto inject the correct language pack into the bootstrap data. For example:from superset.translations.utils import get_language_pack def override_bootstrap_locale(data): if data.get("locale") == "de": data["locale"] = "de" data["language_pack"] = get_language_pack("de") elif data.get("locale") == "fr": data["locale"] = "fr" data["language_pack"] = get_language_pack("fr") return data COMMON_BOOTSTRAP_OVERRIDES_FUNC = override_bootstrap_localeThis ensures the frontend gets the right language pack and doesn't try to fetch it dynamically reference.
-
Rebuild your frontend assets with the latest translations (
npm run build-translationinsuperset-frontend/) and restart Superset reference. -
Clear browser and server caches to avoid stale assets.
-
If you use Docker, make sure your config overrides are in the correct location (e.g.,
./docker/pythonpath_dev/superset_config_docker.py) and containers are rebuilt reference.
If you follow these steps, embedded dashboards should display in the correct language without unauthorized errors or fallback to the deprecated endpoint. If you still see requests to /language_pack/<lang>/, double-check your frontend build and config for mismatches or legacy code.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
@mistercrunch do you have any random insights/ideas here?