dosubot[bot] commented on issue #36459: URL: https://github.com/apache/superset/issues/36459#issuecomment-3628824997
<!-- Greeting --> Hi @gerbermichi! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team. <!-- Answer --> 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](https://github.com/apache/superset/discussions/34885). 2. Use the `COMMON_BOOTSTRAP_OVERRIDES_FUNC` in your `superset_config.py` to inject the correct language pack into the bootstrap data. For example: ```python 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](https://github.com/apache/superset/discussions/35864). 3. Rebuild your frontend assets with the latest translations (`npm run build-translation` in `superset-frontend/`) and restart Superset [reference](https://github.com/apache/superset/issues/35581). 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](https://github.com/apache/superset/issues/33702). 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. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/7d98069d-c458-4285-ad99-69f584e52328?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/7d98069d-c458-4285-ad99-69f584e52328?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/7d98069d-c458-4285-ad99-69f584e52328?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/7d98069d-c458-4285-ad99-69f584e52328?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/7d98069d-c458-4285-ad99-69f584e52328?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/7d98069d-c458-4285-ad99-69f584e52328?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/7d98069d-c458-4285-ad99-69f584e52328?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=In%20Superset%206.0%2B%2C%20the%20%60/language_pack/%3Clang%3E/%60%20endpoint%20is%20deprecated%20and%20no%20longer%20used%20for%20loading%20translations.%20Instead%2C%20language%20packs%20are%20bundled%20into%20the%20initial%20bootstrap%20data%20and%20injected%20into%20the%20frontend%20as%20part%20of%20the%20HTML%20payload.%20If%20your%20embedded%20dashboard%20is%20still%20trying%20to%20fetch%20%60/language_pack/%3Clang%3E/%60%2C%20it%20means%20the%20frontend%20isn%27t%20getting%20the%20language%20pack%20from%20the%20bootstrap%20data%E2%80%94often%20due%20to%20a%20mismatch%20between%20the%20session%20locale%20and%20the%20available%20language%20packs%2C%20or%20because%20the%20frontend%20build%20is%20out%20of%20sync%20with%20your%20config.%0A%0ATo%2 0fix%20this%3A%0A%0A1.%20Make%20sure%20your%20frontend%20and%20backend%20are%20both%20running%20the%20standard%206.0%2B%20codebase%2C%20and%20that%20you%20don%27t%20have%20any%20custom%20code%20or%20legacy%20logic%20trying%20to%20fetch%20%60/language_pack/%3Clang%3E/%60%C2%A0%5Breference%5D%28https%3A//github.com/apache/superset/discussions/34885%29.%0A2.%20Use%20the%20%60COMMON_BOOTSTRAP_OVERRIDES_FUNC%60%20in%20your%20%60superset_config.py%60%20to%20inject%20the%20correct%20language%20pack%20into%20the%20bootstrap%20data.%20For%20example%3A%0A%0A%20%20%20%60%60%60python%0A%20%20%20from%20superset.translations.utils%20import%20get_language_pack%0A%0A%20%20%20def%20override_bootstrap_locale%28data%29%3A%0A%20%20%20%20%20%20%20if%20data.get%28%22locale%22%29%20%3D%3D%20%22de%22%3A%0A%20%20%20%20%20%20%20%20%20%20%20data%5B%22locale%22%5D%20%3D%20%22de%22%0A%20%20%20%20%20%20%20%20%20%20%20data%5B%22language_pack%22%5D%20%3D%20get_language_pack%28%22de%22%29%0A%20%20%20%20%20%20%20eli f%20data.get%28%22locale%22%29%20%3D%3D%20%22fr%22%3A%0A%20%20%20%20%20%20%20%20%20%20%20data%5B%22locale%22%5D%20%3D%20%22fr%22%0A%20%20%20%20%20%20%20%20%20%20%20data%5B%22language_pack%22%5D%20%3D%20get_language_pack%28%22fr%22%29%0A%20%20%20%20%20%20%20return%20data%0A%0A%20%20%20COMMON_BOOTSTRAP_OVERRIDES_FUNC%20%3D%20override_bootstrap_locale%0A%20%20%20%60%60%60%0A%0A%20%20%20This%20ensures%20the%20frontend%20gets%20the%20right%20language%20pack%20and%20doesn%27t%20try%20to%20fetch%20it%20dynamically%C2%A0%5Breference%5D%28https%3A//github.com/apache/superset/discussions/35864%29.%0A%0A3.%20Rebuild%20your%20frontend%20assets%20with%20the%20latest%20translations%20%28%60npm%20run%20build-translation%60%20in%20%60superset-frontend/%60%29%20and%20restart%20Superset%C2%A0%5Breference%5D%28https%3A//github.com/apache/superset/issues/35581%29.%0A4.%20Clear%20browser%20and%20server%20caches%20to%20avoid%20stale%20assets.%0A5.%20If%20you%20use%20Docker%2C%20make%20sure%20your%20confi g%20overrides%20are%20in%20the%20correct%20location%20%28e.g.%2C%20%60./docker/pythonpath_dev/superset_config_docker.py%60%29%20and%20containers%20are%20rebuilt%C2%A0%5Breference%5D%28https%3A//github.com/apache/superset/issues/33702%29.%0A%0AIf%20you%20follow%20these%20steps%2C%20embedded%20dashboards%20should%20display%20in%20the%20correct%20language%20without%20unauthorized%20errors%20or%20fallback%20to%20the%20deprecated%20endpoint.%20If%20you%20still%20see%20requests%20to%20%60/language_pack/%3Clang%3E/%60%2C%20double-check%20your%20frontend%20build%20and%20config%20for%20mismatches%20or%20legacy%20code.) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/36459) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
