superset icon indicating copy to clipboard operation
superset copied to clipboard

[6.0.0‑RC2] Partial Translations

Open innovark37 opened this issue 1 year ago • 11 comments

Bug description

Steps to reproduce

  1. Deploy the Docker version of Superset based on 6.0.0rc2 (same on the master-branch build version).
  2. In config.py set the LANGUAGES variables, for example:
LANGUAGES = {
    "en": {"flag": "us", "name": "English"},
    "es": {"flag": "es", "name": "Spanish"},
    "it": {"flag": "it", "name": "Italian"},
    "fr": {"flag": "fr", "name": "French"},
    "zh": {"flag": "cn", "name": "Chinese"},
    "zh_TW": {"flag": "tw", "name": "Traditional Chinese"},
    "ja": {"flag": "jp", "name": "Japanese"},
    "de": {"flag": "de", "name": "German"},
    "pl": {"flag": "pl", "name": "Polish"},
    "pt": {"flag": "pt", "name": "Portuguese"},
    "pt_BR": {"flag": "br", "name": "Brazilian Portuguese"},
    "ru": {"flag": "ru", "name": "Russian"},
    "ko": {"flag": "kr", "name": "Korean"},
    "sk": {"flag": "sk", "name": "Slovak"},
    "sl": {"flag": "si", "name": "Slovenian"},
    "nl": {"flag": "nl", "name": "Dutch"},
    "uk": {"flag": "uk", "name": "Ukranian"},
}
  1. Compile translations as described here
# Install dependencies if you haven't already
cd superset-frontend/ && npm ci
# Compile translations for the frontend
npm run build-translation

# inside the project root
cd ../
pybabel compile -d superset/translations
  1. Open Superset, switch the UI language to any language other than English (e.g., Spanish, French, etc.).
  2. Observe missing translations (e.g. Header, "Settings" menu,"All" tab on welcome page, control panel while editing chart).

Expected behavior All translations are applied in UI as it was in Superset 5.0.0.

Actual behavior The user interface is only partially translated.

Reason for the bug The regression appears to be introduced in PR https://github.com/apache/superset/pull/34119, where language pack is fetching asynchronously.

Screenshots/recordings

Image Image

Superset version

master / latest-dev

Python version

3.11

Node version

18 or greater

Browser

Chrome

Additional context

No response

Checklist

  • [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [ ] 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.

innovark37 avatar Oct 08 '25 10:10 innovark37

The partial Russian translations in Superset 6.0.0rc2 and master are a known regression linked to the switch to asynchronous language pack loading. This change can cause race conditions and locale mismatches, especially if the frontend requests a short locale code like ru but your translation files use ru_RU, resulting in missing translations or fallback to English. This issue affects multiple languages and is more noticeable in frontend React components like dashboards and chart controls source.

To work around this, add an override function to your superset_config.py that maps the short locale code to the full one and loads the correct language pack:

from superset.translations.utils import get_language_pack

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

COMMON_BOOTSTRAP_OVERRIDES_FUNC = override_bootstrap_locale

Make sure your Docker build includes BUILD_TRANSLATIONS=true so Russian translations are actually built into the image source. After updating your config, rebuild frontend translations with npm run build-translation, recompile backend translations with pybabel, and restart the server.

If you still see partial translations, check for locale mismatches, ensure your translation files are up to date, and verify that the override function is being executed. This workaround has resolved similar issues for other languages like Portuguese and Chinese source.

There is ongoing work to address the underlying race condition and improve translation loading, so keep an eye on future releases for a permanent fix source.

To reply, just mention @dosu.


Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about superset Share Dosu with your team

dosubot[bot] avatar Oct 08 '25 10:10 dosubot[bot]

The ticket's title and description have been updated because further investigation has revealed that this is a global issue and affects not only Russian translations but also other languages. The solution proposed by the bot does not resolve the core problem.

innovark37 avatar Oct 09 '25 08:10 innovark37

@innovark37 Hello, did you find a solution to the problem? I have same issue

KirP32 avatar Oct 09 '25 11:10 KirP32

@KirP32 Hi. I just reverted #34119 on my forked branch. It seems to work fine for now.

innovark37 avatar Oct 10 '25 05:10 innovark37

@mistercrunch may need your thoughts on a fix forward without reverting.

sadpandajoe avatar Oct 14 '25 17:10 sadpandajoe

Hello, in my case I noticed only the admin user sees the translations, it also works with the gama role, but not with my public users, I had to grant the "can language pack superset" permission to them.

golan-FabianLC avatar Nov 03 '25 15:11 golan-FabianLC

@dosu didn't we see some related issues about translations loading into builds recently? Please link any relevant issues and PRs here.

rusackas avatar Nov 17 '25 23:11 rusackas

Here are the most relevant recent issues and discussions about translation loading problems in Superset builds, especially after the switch to asynchronous language pack loading in PR #34119:

  • #34751: Partial UI translations in Superset 6.0.0 across multiple languages, even with correct Docker build and language config. Affects visualization panels, tooltips, and more.
  • #34914: Partial translation application due to a suspected race condition between language pack loading and translation usage, especially in frontend React components and chart plugins.
  • #35330: Partial Portuguese translations in 6.0.0rc1 despite correct config and manual compilation. Includes detailed reproduction steps and discussion of frontend/backend translation sync.
  • #34058: Missing translations for menu items in Brazilian Portuguese and other languages due to frontend/backend locale mismatches. Documents the COMMON_BOOTSTRAP_OVERRIDES_FUNC workaround.
  • #35581: 404 errors when loading language packs (e.g., Russian), caused by missing frontend translation files or build issues.
  • Discussion #35312: 404 errors fetching language packs due to short vs. full locale code mismatches; documents the override function workaround.
  • Discussion #33594: Deep dive into frontend/backend locale handling, root cause analysis, and the override workaround for correct language pack loading.

There is also a permission-related aspect: non-admin users need the "can language pack superset" permission to access translations (discussion). This is a workaround, not a fix for the core async loading/race condition bug.

No merged PR currently fully resolves the async loading/global partial translation issue introduced by PR #34119, but maintainers are actively discussing solutions. The override function workaround is widely used but does not address the underlying bug—just locale mismatches.

To reply, just mention @dosu.


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

dosubot[bot] avatar Nov 17 '25 23:11 dosubot[bot]

Image

I'm encountering the same issue where the translation is incomplete. The messages.json file contains extensive translation content, but it doesn't appear on the web interface. I haven't been able to figure out the root cause, but I'll try the rollback commit method mentioned above as an attempt.

weiSnowJhon avatar Dec 30 '25 14:12 weiSnowJhon

Hey, ran into this exact issue while setting up Superset with Chinese as the default language. Spent some time digging into the code and I think I found what's going on.

The Problem (Two Parts)

1. Backend: hardcoded fallback

In superset/views/base.py, there's this line:

language = locale.language if locale else "en"

When get_locale() returns None (like for unauthenticated users on the login page), it just falls back to "en" instead of using the BABEL_DEFAULT_LOCALE config. So the frontend gets locale: "en" in bootstrap data and never even tries to load the language pack.

2. Frontend: race condition

In preamble.ts, the language pack loads in an async IIFE:

(async () => {
  // load language pack...
})();
// nobody awaits this!

And index.tsx just does:

import 'src/preamble';
ReactDOM.render(<App />, ...);  // runs immediately

So React starts rendering before the language pack is ready. By the time it loads, the components already rendered with English text.

Fix I've Been Using

Backend:

language = locale.language if locale else app.config.get("BABEL_DEFAULT_LOCALE", "en")

Frontend: Export initPreamble() as a function returning Promise<void>, then await it before rendering:

// index.tsx
(async () => {
  try {
    await initPreamble();
  } finally {
    const { default: App } = await import('./App');
    ReactDOM.render(<App />, appMountPoint);
  }
})();

This has been working well in my deployment. Happy to put together a PR if this approach makes sense to you all.

tt-a1i avatar Jan 04 '26 08:01 tt-a1i

@tt-a1i thanks ! I've tested your PR on my deployment and works well !

greggailly avatar Jan 08 '26 12:01 greggailly

@tt-a1i thanks!

weiSnowJhon avatar Feb 05 '26 13:02 weiSnowJhon

@tt-a1i I've found out that even if language_pack loads json to client, menu label were not changed. Issue is inside .mo compilation logic. Menu data is loaded to <div id="app" data-bootstrap={.....} .... </div> and you can always check if it was translated or not Custom command for CI/CD. Many languages have issues in compiling stage, but it's enough for menu.

if ! pybabel compile --use-fuzzy -l ru -d "$TRANSLATIONS_DIR" 2>&1 | sed 's/^/   /'; then
    echo "⚠️  pybabel compilation encountered errors (see above), continuing anyway..."
fi

I use apache/superset:6.0.0 image from docker hub, but with multiple customizations for CI/CD.

rsaleev avatar Feb 14 '26 13:02 rsaleev

Hello, I've resolved the issue by building the image with --build-arg BUILD_TRANSLATIONS=true.

BioQwer avatar Feb 14 '26 14:02 BioQwer

@sadpandajoe I'd love to see this fix in 6.0.1. What are the chances it will make it into the release?

Thanks so much everyone!

birke-kb avatar Feb 20 '26 08:02 birke-kb