superset icon indicating copy to clipboard operation
superset copied to clipboard

[6.0.0rc4] i18n Fails in Embedded Dashboards Due to /language_pack/<lang>/ Auth Error

Open gerbermichi opened this issue 2 weeks ago • 1 comments

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.

gerbermichi avatar Dec 08 '25 19:12 gerbermichi

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:

  1. 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.

  2. Use the COMMON_BOOTSTRAP_OVERRIDES_FUNC in your superset_config.py to 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_locale
    

    This ensures the frontend gets the right language pack and doesn't try to fetch it dynamically reference.

  3. Rebuild your frontend assets with the latest translations (npm run build-translation in superset-frontend/) and restart Superset reference.

  4. Clear browser and server caches to avoid stale assets.

  5. 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

Chat with Dosu Open in Cursor Join Discord Share on X

dosubot[bot] avatar Dec 08 '25 20:12 dosubot[bot]

@mistercrunch do you have any random insights/ideas here?

rusackas avatar Dec 09 '25 18:12 rusackas