Skip to content

fix(i18n): enforce the do-not-translate registry across the catalogs - #45974

Merged
rusackas merged 7 commits into
apache:masterfrom
antalotec:fix/i18n-enforce-dnt
Nov 21, 2026
Merged

rusackas merged 7 commits into
apache:masterfrom
antalotec:fix/i18n-enforce-dnt

Conversation

@antalotec

Copy link
Copy Markdown
Contributor

SUMMARY

superset/translations/do-not-translate.txt lists msgids that must stay identical to the
source — icon names, enum and option values, SQL keywords, API field names, code constants
and example placeholders. Nothing enforces it:

  • apply_do_not_translate.py stamps an advisory #. do-not-translate comment. A
    translation that ignores it is accepted.
  • backfill_po.py honours the registry for entries it generates, so it never creates a
    violation — but entries translated before a term was registered, or by hand, are
    untouched.

The result is that the registry has quietly drifted out of effect. On current master,
233 entries across 27 of the 29 catalogs translate a registered msgid, covering 23 of
the 27 registered terms (only step-after, step-before, WMS and XYZ are respected
everywhere):

msgid catalogs translating it example
DELETE 24 ca → ELIMINAR
OVERWRITE 23 cs → PŘEPSAT
NOT GROUPED BY 22 ca → NO AGRUPAT PER
bolt 22 ca → negreta, cs → šroub (it is an icon name)
GROUP BY 21 cs → SESKUPIT PODLE
error_message 20 ca → missatge_error (an API field name)
TEMPORAL_RANGE 18 ca → RANG_TEMPORAL
pivoted_xlsx 15 es → Pivotado (an option value)
deck.gl Geojson, EMAIL_REPORTS_CTA, crontab, dttm, ECharts, p1/p5/p95/p99, 10000, sql, WFS, superset.example.com, schema1,schema2, your-project-1234-a1 1–11 each

This PR empties those msgstrs — the same fix #41652 applied to es, fi and th — so
gettext falls back to the source token, and adds a check so the registry stops being
advisory.

What is in the diff

  1. 237 entries emptied across 27 catalogs (233 for the existing registry, 4 for the new
    entry below). Where the entry also carried a stale #, fuzzy flag, the flag goes with
    the translation.
  2. Handlebars added to the registry, with its #. do-not-translate marker stamped in
    the template and the catalogs. It is the name of the templating library the chart plugin
    uses, and four catalogs translate the everyday sense of the word — the bicycle part:
    ar المقاود, tr Tutbarlar, pl Uchwyty, fa هندلBars. This is the one
    judgement call in the PR; happy to drop it if you would rather keep the registry to its
    current contents.
  3. scripts/translations/check_do_not_translate.py plus a step in the babel-extract
    job. It reports every registered msgid with a non-empty msgstr that differs from the
    msgid, and exits non-zero.

A consequence worth stating

DELETE and OVERWRITE are the words typed into the delete and overwrite confirmation
modals. Emptying them means a Spanish user now types DELETE rather than BORRAR. That is
what the registry asks for — both strings are compared against user input — but it is a
visible change, so it should be a deliberate decision rather than a side effect. We checked
that no catalog is currently broken by this: every existing translation is already
uppercase-stable, so toUpperCase() matching works today in all of them.

Follow-up to #45953, which repaired malformed format specifiers in three of these
catalogs.

TESTING INSTRUCTIONS

python scripts/translations/check_do_not_translate.py        # passes on this branch
git stash && python scripts/translations/check_do_not_translate.py   # fails on master, listing all 233

Also run locally, all green:

  • msgfmt --check across the 30 catalogs — 5 fatal errors, unchanged from master (they
    come from unrelated defects: one source string whose msgid and msgid_plural name
    different placeholders, and msgid "% of" flagged #, python-format in de), so this
    introduces none
  • python scripts/translations/check_pot_drift.py — template matches a fresh extraction
  • python scripts/translations/check_translation_regression.py --compare <baseline> —
    No translation regressions (counts drop as entries are emptied, which the check
    correctly does not treat as a regression)
  • mypy --check-untyped-defs on the new script — matches the result of the existing
    build_translation_index.py in the same environment

A small inconsistency noticed, not changed here

The header comment in do-not-translate.txt says the marker is
#. MACHINE_READ-DO_NOT_TRANSLATE, while apply_do_not_translate.py stamps
#. do-not-translate. Left alone to keep this diff to one concern.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration
  • Introduces new feature or API
  • Removes existing feature or API

Developed at MYSPHERA, S.L.

🤖 Generated with Claude Code

do-not-translate.txt lists msgids that must stay identical to the source,
but nothing rejects a catalog that translates one: apply_do_not_translate.py
only stamps an advisory comment, and backfill_po.py honours the registry
only for entries it generates. 233 entries across 27 catalogs translate a
registered msgid, among them icon names, API field names and SQL keywords.

Empty those msgstrs so gettext falls back to the source token, add
Handlebars to the registry (four catalogs translate the bicycle part), and
add a check plus a CI step so the registry stops being advisory.

Co-Authored-By: Claude Opus 5 <[email protected]>
@antalotec
antalotec requested a review from msyavuz as a code owner November 3, 2026 09:46
@github-actions github-actions Bot added i18n Namespace | Anything related to localization i18n:spanish Translation related to Spanish language i18n:italian Translation related to Italian language i18n:french Translation related to French language i18n:chinese Translation related to Chinese language i18n:japanese Translation related to Japanese language i18n:russian Translation related to Russian language i18n:korean Translation related to Korean language github_actions Pull requests that update GitHub Actions code i18n:dutch i18n:slovak i18n:ukrainian i18n:portuguese i18n:brazilian i18n:traditional-chinese labels Nov 3, 2026
The gate had no test, so a later edit could quietly stop it protecting
anything: with no violation left in the catalogs it would still pass CI.
Pin the one comparison it turns on — a registered msgid is clean only when
its msgstr is exactly empty — and cover the cases that comparison decides:
" DELETE ", "   " and a real translation are reported; "", an identical
msgstr, an obsolete entry and an unregistered msgid are not. main() exits 1
and names the offender, or returns cleanly, and the en catalog is skipped.

Co-Authored-By: Claude Opus 5 <[email protected]>
@netlify

netlify Bot commented Nov 3, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 4e0a365
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6ae9e168797054c68ea0e8b3
😎 Deploy Preview https://deploy-preview-45974--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.

@sadpandajoe sadpandajoe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sha174n sha174n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

polib is a hard requirement of the script, so let a missing install
fail with the interpreter's own ImportError instead of wrapping it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @antalotec, LGTM! Nice to see the registry actually enforced rather than just advisory. Adding Handlebars seems right to me too, since it's the library name and not the bicycle part :)

@hainenber

Copy link
Copy Markdown
Contributor

LGTM but needs to resolve the current merge conflict

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Nov 21, 2026
Resolve messages.pot by keeping both sides: master's new Druid HTTPS msgid
and this branch's do-not-translate comment on Handlebars.

Co-Authored-By: Evan Rusackas <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Nov 21, 2026
@rusackas
rusackas merged commit 9a76138 into apache:master Nov 21, 2026
72 checks passed
jprinet added a commit to jprinet/superset that referenced this pull request Nov 23, 2026
* origin/master: (393 commits)
  fix(a11y): name the semantic view description input (apache#46458)
  docs(semantic): explain datasource list modification eligibility (apache#46462)
  docs(semantic-layer): document NULL-preserving exclusion filters (apache#46447)
  fix(uploads): skip folder and system entries in columnar ZIP uploads (apache#45617)
  fix(i18n-es): promote 47 of the zero-context backfill entries (apache#45847)
  fix(mcp): return structured ChartError on SQLAlchemyError in get_chart_sql (apache#44351)
  fix(datasets): follow semantic view modification permissions (apache#46448)
  fix(docker): account for container memory limits in frontend-mem-nag.sh (apache#46373)
  fix(reports): carry the report's native filters in the email and Slack link (apache#46062)
  fix(explore): apply the dataset timezone to grained temporal filter values (apache#46175)
  fix(i18n): enforce the do-not-translate registry across the catalogs (apache#45974)
  chore(logging): log unparseable virtual dataset SQL at debug in the RLS lookup (apache#46139)
  fix(i18n): split parameter-suggestion plural into two messages (apache#46049)
  test(partition-mapping): cover Hive/Impala mirrored SQL, cache outage and migration (apache#46319)
  perf(dashboard): look up the dashboard once per filter_state read (apache#46314)
  fix(i18n): load the dayjs locale for every language with a catalog (apache#45982)
  test(semantic-layer): make date export parametrization deterministic (apache#46449)
  fix(oauth2): idempotent OAuth2 completion and resilient listener (apache#40292)
  fix(explore): prevent full table scan when SQL expression is used as x-axis (apache#41339)
  feat(mcp): radar chart type plugin (apache#43571)
  ...

# Conflicts:
#	.github/workflows/docker.yml
#	.github/workflows/superset-frontend.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code i18n:arabic i18n:brazilian i18n:catalan i18n:chinese Translation related to Chinese language i18n:czech i18n:dutch i18n:finnish i18n:french Translation related to French language i18n:german Translation related to German language i18n:italian Translation related to Italian language i18n:japanese Translation related to Japanese language i18n:korean Translation related to Korean language i18n:latvian i18n:maori i18n:persian i18n:polish i18n:portuguese i18n:romanian i18n:russian Translation related to Russian language i18n:serbian i18n:serbian-latin i18n:slovak i18n:slovenian i18n:spanish Translation related to Spanish language i18n:tamil i18n:thai i18n:traditional-chinese i18n:turkish i18n:ukrainian i18n Namespace | Anything related to localization risk:ci-script PR modifies scripts that execute in CI (supply chain risk) size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants