Skip to content

fix(i18n): compile fuzzy translations into the backend .mo files - #41648

Merged
rusackas merged 2 commits into
masterfrom
fix/i18n-serve-fuzzy-backend
Jul 2, 2026
Merged

rusackas merged 2 commits into
masterfrom
fix/i18n-serve-fuzzy-backend

Conversation

@rusackas

@rusackas rusackas commented Jul 2, 2026

Copy link
Copy Markdown
Member

SUMMARY

The main Dockerfile compiled backend translations with a bare pybabel compile, which omits #, fuzzy entries — so fuzzy (machine-generated and other draft) translations fell back to English on the backend. This is inconsistent with every other translation build path in the repo:

  • the frontend build (superset-frontend/scripts/po2json.sh) runs po2json --fuzzy, which includes fuzzy entries;
  • flask fab babel-compile — used by the RELEASING images (RELEASING/Dockerfile.from_*_tarball) and scripts/translations/generate_mo_files.sh — runs pybabel compile -f internally (see flask_appbuilder/cli.py).

So the production image was the only path dropping fuzzy translations. This PR adds --use-fuzzy to the Dockerfile's pybabel compile, making the backend serve fuzzy translations consistently with the frontend and the other backend build paths.

Motivation: we're running an AI-assisted backfill across the language catalogs (fuzzy-marked, pending native-speaker review — see the de/lv/fi/es/sk/th/uk/cs PRs). With this change, those draft translations (and any other #, fuzzy entries) are shown in the UI on both frontend and backend rather than falling back to English while awaiting review. #, fuzzy remains the "needs review" marker; reviewers de-fuzz to confirm.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Backend-compiled catalogs (BUILD_TRANSLATIONS=true):

  • Before: #, fuzzy entries excluded → English fallback in server-rendered strings.
  • After: #, fuzzy entries included → translated string served (matching the frontend).

TESTING INSTRUCTIONS

# fuzzy entry is included with --use-fuzzy, excluded without it
pybabel compile --use-fuzzy --statistics -d superset/translations

Build the image with --build-arg BUILD_TRANSLATIONS=true and confirm a #, fuzzy backend string renders translated rather than in English.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
  • Introduces new feature or API
  • Removes existing feature or API

The main Dockerfile compiled backend translations with a bare `pybabel compile`,
which omits `#, fuzzy` entries — so fuzzy (machine-generated and other draft)
translations fell back to English on the backend. This was inconsistent with
every other translation build path in the repo:

- the frontend build (`po2json --fuzzy`) includes fuzzy entries;
- `flask fab babel-compile` (used by the RELEASING images and
  scripts/translations/generate_mo_files.sh) runs `pybabel compile -f`.

Add `--use-fuzzy` to the Dockerfile's `pybabel compile` so the production image
serves fuzzy translations consistently with the frontend and the other backend
build paths. This makes the AI backfill effort (and any other draft
translations) visible in the UI rather than falling back to English while they
await native-speaker review. Docs updated to match.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@dosubot dosubot Bot added doc:developer Developer documentation i18n Namespace | Anything related to localization labels Jul 2, 2026
@bito-code-review

bito-code-review Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #24cb17

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 7756ca8..7756ca8
    • Dockerfile
  • Files skipped - 1
    • docs/developer_docs/contributing/howtos.md - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions Bot added doc Namespace | Anything related to documentation and removed i18n Namespace | Anything related to localization labels Jul 2, 2026
@netlify

netlify Bot commented Jul 2, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 7756ca8
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a45ac8d7b404e000822e3b9
😎 Deploy Preview https://deploy-preview-41648--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread Dockerfile Resolved
@bito-code-review

Copy link
Copy Markdown
Contributor

The flagged issue is correct. Piping pybabel compile to true masks any compilation errors, which can lead to silent failures where the Docker build succeeds despite missing or incomplete translation files.

To resolve this, you should remove the pipe to true and allow the command to exit with its native status. If you want to ensure the build continues even on failure, you should explicitly handle the error or use || true only if you have verified that failure is acceptable in that specific context.

Proposed Fix

In Dockerfile, update the RUN command to remove the pipe:

RUN if [ "${BUILD_TRANSLATIONS}" = "true" ]; then \
        pybabel compile --use-fuzzy -d /app/translations_mo; \
    fi; \
    rm -f /app/translations_mo/*/*/*.[po,json]

There are no other comments in this pull request to address.

Dockerfile

RUN if [ "${BUILD_TRANSLATIONS}" = "true" ]; then \
        pybabel compile --use-fuzzy -d /app/translations_mo; \
    fi; \
    rm -f /app/translations_mo/*/*/*.[po,json]

@rusackas
rusackas merged commit aa40934 into master Jul 2, 2026
51 checks passed
@rusackas
rusackas deleted the fix/i18n-serve-fuzzy-backend branch July 2, 2026 17:43
@bito-code-review

Copy link
Copy Markdown
Contributor

Bito Automatic Review Skipped – PR Already Merged

Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.
No action is needed if you didn't intend to review it. To get a review, you can type /review in a comment and save it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc:developer Developer documentation doc Namespace | Anything related to documentation size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants