Just opening the issue based in the discussion, i also got this problem. The OP did a fix for it together with Dosu


Captura de tela de 2025-05-27 13-27-34

I'm having trouble to translate settings on the top menu, i already tried changing the default locale with: BABEL_DEFAULT_LOCALE = 'pt_BR'

I also fixed all the warning related to the pt_BR that appeared when using the command: pybabel compile -d superset/translations

To debug i used the following commands on the function menu_data to see what was happening: print(session.get("locale")) // printed: pt_BR print(__("Settings")) // printed: Configurações

So i can't understand why it doesn't work, anyone has worked on this problem? some other languages seem to have the same problem but i'm only working on brazilian portuguese but the other languages i tested and had this problem were: italian, portuguese, brazilian portuguese, korean and slovak.

Originally posted by @ViniciusCavalcanteSantos in https://github.com/apache/superset/discussions/33594

Comment From: dosubot[bot]

This is a known issue in Superset: even if the backend and Flask-Babel are set to pt_BR and the translation for "Settings" exists, the frontend may still show "Settings" in English because the frontend and backend handle translations separately. By default, the backend sends only the language code (like "pt") to the frontend, which causes the frontend to load the wrong language pack and miss the pt_BR translation for menu items like "Settings" (and this affects other languages too) [discussion].

To fix this, add the following to your superset/config.py:

from superset.translations.utils import get_language_pack

def override_bootstrap_locale(data):
    if data.get("locale") == "pt":
        data["locale"] = "pt_BR"
        data["language_pack"] = get_language_pack('pt_BR')
    return data

COMMON_BOOTSTRAP_OVERRIDES_FUNC = override_bootstrap_locale

Then rebuild your frontend translations:

cd superset-frontend/
npm run build-translation

This ensures the frontend receives and loads the correct pt_BR language pack, so "Settings" and other menu items will be translated as expected [discussion].

If you still see mixed languages, check that your LANGUAGES dictionary in superset/config.py includes "pt_BR" and that your translation files are up to date and compiled [docs].

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

Comment From: Ronkiro

I've added this to my configOverrides (to help Helm newbies like me)

fix_i18n: |
    from superset.translations.utils import get_language_pack
    def override_bootstrap_locale(data):
        # If the session or user locale is 'pt_BR', force the frontend to use 'pt_BR'
        print("Overriding locale to pt_BR if necessary")
        print("Current locale in data:", data.get("locale"))
        if data.get("locale") == "pt":
            data["locale"] = "pt_BR"
            data["language_pack"] = get_language_pack('pt_BR')
        return data
    COMMON_BOOTSTRAP_OVERRIDES_FUNC = override_bootstrap_locale