dosubot[bot] commented on issue #34084: URL: https://github.com/apache/superset/issues/34084#issuecomment-3044262165
<!-- Greeting --> Hi @HCTzz! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team. <!-- Answer --> This issue happens because Superset expects the language code sent from the backend to exactly match the translation folder name (like `zh_TW`), but the backend often sends a simplified code (like `zh`) or an expanded one (like `zh_Hant_TW`), which doesn't match your `translations/zh_TW` folder. As a result, the frontend loads the wrong or fallback language pack, making the zh_TW switch ineffective. To fix this, you can override the bootstrap locale in your `superset/config.py` to normalize any variant (such as `zh`, `zh_Hant_TW`, or `zh_Cant_TW`) to `zh_TW`. Here’s an example: ```python def override_bootstrap_locale(data): # Normalize all Traditional Chinese variants to zh_TW if data.get("locale") in ["zh", "zh_Hant_TW", "zh_Cant_TW"]: data["locale"] = "zh_TW" data["language_pack"] = get_language_pack("zh_TW") return data COMMON_BOOTSTRAP_OVERRIDES_FUNC = override_bootstrap_locale ``` After making this change, rebuild your frontend translations with: ```bash cd superset-frontend/ npm run build-translation ``` This ensures the frontend receives and loads the correct language pack for Traditional Chinese. For more details, see [this discussion](https://github.com/apache/superset/discussions/33594) and [related code references](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/views/base.py). If you still see mixed languages, double-check that your `LANGUAGES` config includes `"zh_TW"` and that your translation files are up to date. <!-- 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/a8ee40d6-8f22-467f-8132-6fcc94bfed70?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/a8ee40d6-8f22-467f-8132-6fcc94bfed70?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/a8ee40d6-8f22-467f-8132-6fcc94bfed70?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/a8ee40d6-8f22-467f-8132-6fcc94bfed70?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/a8ee40d6-8f22-467f-8132-6fcc94bfed70?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/a8ee40d6-8f22-467f-8132-6fcc94bfed70?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/a8ee40d6-8f22-467f-8132-6fcc94bfed70?feedback_type=other)</sup> [](https://go.dosu.dev/discord-bot) [! [Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/34084) -- 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]
