Skip to content

feat(i18n): extract translator context comments from source - #44397

Merged
hainenber merged 15 commits into
apache:masterfrom
glaterza:feat/i18n-translator-context-comments
Oct 10, 2026
Merged

hainenber merged 15 commits into
apache:masterfrom
glaterza:feat/i18n-translator-context-comments

Conversation

@glaterza

@glaterza glaterza commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

SUMMARY

Updated after review (latest eea7e18d22).

  • The howto lists where an i18n: note is extracted and where pybabel drops it (c9b30d6e4f). It no longer says the note overrides other languages in the AI backfill.
  • Tests cover a hyphenated do-not-translate in a note, a note on a plural, and a new noted string (49825ae856).
  • A fixture test replaces the test that read the committed catalogs (96d0540834). It runs the pybabel update call from babel_update.sh on a temporary template and catalog.
  • The four #. i18n: notes are in all 30 language catalogs, not only the template (1357bc4ce4).
  • backfill_po.py sends the note to the model as a "Developer note" (7ccf383b48). A live run found that it does not override unanimous misleading references; see the end of TESTING INSTRUCTIONS.
  • The drift check fails when a note in source differs from the template (7ccf383b48).
  • The drift check extracts with the same flags as babel_update.sh, and a test compares them (6a3c79e3ad).
  • Only the exact stamped do-not-translate line marks an entry as do-not-translate (4bbce5afc3). A note such as "do not translate as the animal" still reaches the model.
  • The Backend note covers semantic layers (4bbce5afc3). That column lists them when SEMANTIC_LAYERS is on.
  • The howtos section "Extracting new strings" points at babel_update.sh (6a3c79e3ad).

A catalog shows a translatable string without its code. A term that is clear at the call site can get a wrong translation in the catalog.
Each of these translations is in a catalog on master:

msgid locale translation on master meaning
Slug nl Slak the animal (a snail or slug)
Slug de Kopfzeile "header line"
Host it Ospite "guest"
Backend ru Драйвер "Driver"
Backend fr Serveur "server", not the engine

Russian renders Slug correctly as Читаемый URL ("readable URL").
The error depends on the language and the string, so one central fix cannot correct it.
The context has to reach the catalog with the string.

This PR passes --add-comments=i18n: to pybabel extract.
A comment tagged i18n: directly above a translatable string becomes a #. i18n: ... extracted comment on that entry:

# i18n: the short identifier in a dashboard's URL, not the animal
"slug": _("Slug"),
#. i18n: the short identifier in a dashboard's URL, not the animal
msgid "Slug"
msgstr ""

pybabel update copies extracted comments from messages.pot into every language catalog.
The existing #. do-not-translate marker uses the same mechanism.
Human translators see the note in the catalog they edit.
The AI backfill does not read extracted comments, so backfill_po.py adds the note to the prompt.

pybabel extract reads comments that start with i18n:, plus any comment lines between that line and the call.
It drops a note after a blank line, inside the call's parentheses, or above a Python _( whose string starts on the next line.
The howto lists these placements, because the drift check cannot see a dropped note.

The PR adds notes to three terms with wrong translations on master, and to one ambiguous phrase.
It documents the convention under Contributing Translations.

Readers of these comments

Each reader, and the check for it:

Reader Effect Checked by
babel_update.sh extracts the notes into messages.pot, then into every catalog full run: 4 notes in each of the 30 catalogs
check_pot_drift.py (CI babel-extract) fails when a note in source differs from the template test, and the negative control below
backfill_po.py sends the note to the model; only the exact do-not-translate line counts as a marker tests that fail on the previous code (below)
apply_do_not_translate.py inserts its marker directly above the msgid, which is valid next to a note code read; no registry msgid has a note
pybabel compile, npm run build-translation ignore comments; .mo and JSON files carry msgid and msgstr only CI frontend-check-translations passes

Note propagation test

test_pybabel_update_carries_the_note_into_catalogs builds a template and a catalog in a temporary directory.
It reads the pybabel update call from babel_update.sh and replaces only the -i and -d paths.
It runs that call, then reads the note back with _developer_note.
It covers an added, a reworded, a removed and a wrapped note.
The test builds its own input, so a contributor's new note does not change its result.

Most upstream PRs commit messages.pot without the catalogs.
All of the last 8 master commits that changed messages.pot committed no catalog (measured 2026-10-08 at c1908747b1).
At that commit, every catalog lacks 21 template msgids and keeps 1 stale one.

Scenario matrix: each row is a contributor change, reverted after the run.
Columns: the drift check, the first test (pinned counts), a loosened test that was never pushed, and the fixture test.

Scenario drift first loosened fixture
S0 no change pass pass pass pass
S1 new note, .py, full regeneration pass FAIL 5 == 4 pass pass
S2 new 2-line note, .tsx, full regeneration pass FAIL pass pass
S3 reworded note, full regeneration pass pass pass pass
S4 removed note, full regeneration pass FAIL 3 == 4 pass pass
S5 note on a plural, full regeneration pass FAIL pass pass
S6 new note, template only pass FAIL FAIL pass
S7 new string and note, full regeneration pass FAIL pass pass
S8 new string and note, template only pass FAIL FAIL AttributeError pass
S9 new note, nothing regenerated FAIL pass pass pass

S9 fails the drift check, which is the expected result.

Negative controls on test_pybabel_update_carries_the_note_into_catalogs:

  • With -l fr added to the update call in babel_update.sh, 4 of 4 cases fail.
  • With --domain other added to that call, 4 of 4 cases fail.
  • With pybabel update skipped, 4 of 4 cases fail.
  • With _developer_note dropping continuation lines, 1 case fails.
  • With _developer_note keeping the do-not-translate marker, 1 case fails.

Merging

#44395 changed msgcat normalization in the same script and has merged.
This branch merges into master without conflicts.
Running babel_update.sh on this head changes no i18n: line and keeps all 25 do-not-translate markers.
In messages.pot it changes only the POT-Creation-Date line.
In the catalogs it adds the 7 msgids they lack at this head: 31 files, +1,038/−108.

msgfmt --check-format reports errors in the fr, it, pt and sl catalogs.
These errors are on master, and none is on a line this PR changes.

@rusackas suggested this approach in discussion #43562.

A docs PR with a Translation Guide follows after this PR merges.
It links a heading that this PR adds to howtos.md.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before, the defect in the running app: Russian UI, Databases list.
The Backend column header reads «Драйвер» ("Driver"). apache/superset:latest (6.1.0), locale ru, 2026-09-17.

Superset Databases list in Russian; the Backend column header reads Драйвер, meaning Driver

After, the note a translator sees in every catalog (Russian shown):

#. i18n: the kind of system behind a connection: a database engine
#. (PostgreSQL, MySQL) or a semantic layer; not a server tier or a driver
msgid "Backend"
msgstr "Драйвер"

Docs: Contributing → Development How-tos → Adding context for translators.
Rendered from 4bbce5afc3 with the local docs server:

The howtos section Adding context for translators, rendered locally

The drift check fails on a stale note, with the source reworded and the template not regenerated.
It passes after git checkout restores the source:

$ python scripts/translations/check_pot_drift.py
superset/translations/messages.pot is out of sync with source: 0 string(s) in source are missing from the template, 0 string(s) in the template no longer exist in source, 1 string(s) have changed i18n: comments.

With i18n: comments that differ from source (1):
  ~ 'Slug'
$ git checkout superset/views/dashboard/mixin.py
$ python scripts/translations/check_pot_drift.py
superset/translations/messages.pot matches a fresh extraction.

TESTING INSTRUCTIONS

./scripts/translations/babel_update.sh

# the notes are on the .pot entries:
grep -A2 '^#\. i18n:' superset/translations/messages.pot

# and in every catalog (expect 30):
grep -l '^#\. i18n:' superset/translations/*/LC_MESSAGES/messages.po | wc -l

git checkout -- superset/translations

babel_update.sh re-extracts from source and updates every catalog.
It also adds upstream strings that the catalogs lack.
In the catalogs, the four notes are this PR's only change.
In the template, it also updates POT-Creation-Date. msgcat --no-wrap joins one msgid that master committed across three lines.

The tests, and a negative control for each fix:

pytest tests/unit_tests/scripts/translations/          # 135 passed (see the note below)

# do-not-translate: the previous backfill_po.py fails the new tests
git show be9a7a7c71:scripts/translations/backfill_po.py > scripts/translations/backfill_po.py
pytest tests/unit_tests/scripts/translations/backfill_po_test.py   # 6 failed
git checkout scripts/translations/backfill_po.py

# drift check: a reworded note without a regenerated template fails
sed -i.bak 's/the short identifier in a dashboard/the short ID in a dashboard/' superset/views/dashboard/mixin.py && rm superset/views/dashboard/mixin.py.bak
python scripts/translations/check_pot_drift.py          # ~ 'Slug', exit 1
git checkout superset/views/dashboard/mixin.py
python scripts/translations/check_pot_drift.py          # matches, exit 0

pr-verify deselected tests/unit_tests/scripts/translations/babel_update_test.py::test_the_trailing_line_strip_keeps_the_last_entry_intact for this head.
On a machine with gettext, that test also fails.
That test comes from master (#44395) and is not part of this PR.
Its restricted PATH has no python, which babel_update.sh calls.
CI skips it, because the Python-Unit runner has no gettext.

Restore files with git checkout, as shown, and not by moving a backup file back.
check_pot_drift.py calls git stash create.
That command exits 1 when a rewrite left a tracked file's content identical.
The check then stops with a CalledProcessError.
This behavior is on master, independent of this PR.

Named tests:

  • test_pybabel_update_carries_the_note_into_catalogs: pybabel update carries a note into a catalog.
  • test_extraction_carries_i18n_comments_to_the_template: a real extraction keeps tagged comments and drops untagged ones.
  • test_extract_flags_match_babel_update_sh
  • test_is_do_not_translate_ignores_prose_in_an_i18n_note
  • test_backfill_skips_do_not_translate_entries_end_to_end

Live AI run (2026-10-08). translate_batch translated ru Backend 6 times per case with the script's default model, claude-sonnet-4-6.

References Note Result
misleading (de Treiber, fr Serveur, it and pt_BR Driver, es Controlador) none Драйвер 6 of 6
misleading final wording Драйвер 5 of 6, База данных 1
misleading the September wording Драйвер 6 of 6
the 29 other catalogs none Бэкенд 6 of 6
the 29 other catalogs final wording Бэкенд 6 of 6

The note did not change the model's answer in either case.
An earlier round reported 3 of 6 without the note and 0 of 6 with it; this run does not reproduce that result.
The notes inform human translators in every catalog.
Making the prompt follow a note over unanimous references is a separate change.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Generated with Claude Code

@bito-code-review

bito-code-review Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #953e4d

Actionable Suggestions - 0
Review Details
  • Files reviewed - 6 · Commit Range: 34beb41..34beb41
    • scripts/translations/babel_update.sh
    • superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx
    • superset-frontend/src/pages/DatabaseList/index.tsx
    • superset-frontend/src/utils/getChartRequiredFieldsMissingMessage.ts
    • superset/translations/messages.pot
    • superset/views/dashboard/mixin.py
  • Files skipped - 1
    • docs/developer_docs/contributing/howtos.md - Reason: Filter setting
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions Bot added i18n Namespace | Anything related to localization doc Namespace | Anything related to documentation risk:ci-script PR modifies scripts that execute in CI (supply chain risk) labels Sep 17, 2026
@netlify

netlify Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

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

@codecov

codecov Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.71%. Comparing base (1ebfea2) to head (eea7e18).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #44397   +/-   ##
=======================================
  Coverage   82.71%   82.71%           
=======================================
  Files        3011     3011           
  Lines      188332   188332           
  Branches    43716    43716           
=======================================
  Hits       155775   155775           
  Misses      29787    29787           
  Partials     2770     2770           
Flag Coverage Δ
hive 36.16% <ø> (ø)
javascript 78.42% <ø> (ø)
mysql 55.20% <ø> (ø)
postgres 55.21% <ø> (-0.01%) ⬇️
presto 38.01% <ø> (ø)
python 86.53% <ø> (ø)
sqlite 54.94% <ø> (ø)
unit 79.86% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bito-code-review

bito-code-review Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #82a731

Actionable Suggestions - 0
Additional Suggestions - 1
  • scripts/translations/babel_update.sh - 1
    • Drift-check flags out of sync · Line 54-54
      `check_pot_drift.py`'s `EXTRACT_FLAGS` claims to be 'Kept in sync' with this `pybabel extract` invocation but omits the new `--add-comments=i18n:` flag. The drift check compares msgids only, so it still passes, but the sync comment is now false and the two invocations can silently diverge. Add the flag there or correct the comment.
Review Details
  • Files reviewed - 6 · Commit Range: 157bf32..157bf32
    • scripts/translations/babel_update.sh
    • superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx
    • superset-frontend/src/pages/DatabaseList/index.tsx
    • superset-frontend/src/utils/getChartRequiredFieldsMissingMessage.ts
    • superset/translations/messages.pot
    • superset/views/dashboard/mixin.py
  • Files skipped - 1
    • docs/developer_docs/contributing/howtos.md - Reason: Filter setting
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@glaterza
glaterza force-pushed the feat/i18n-translator-context-comments branch from 157bf32 to 24c455c Compare September 24, 2026 15:14
@glaterza

Copy link
Copy Markdown
Contributor Author

Rebased onto current master (2ac6e2468d). No conflicts, and the change is unchanged: the same seven files, +59 lines.

Re-checked after the rebase, since master's template was regenerated in the meantime by #44467, #44574 and #44584:

  • the four #. i18n: comments are still in messages.pot
  • check_pot_drift.py: "messages.pot matches a fresh extraction."
  • Python pre-commit hooks pass on the changed files

CI was red here only because the branch predated #44574, which fixed the template drift on master. That should clear with this rebase.

Comment thread docs/developer_docs/contributing/howtos.md
@bito-code-review

Copy link
Copy Markdown
Contributor

The issue is correct. While scripts/translations/babel_update.sh was updated to include --add-comments=i18n:, the documentation in docs/developer_docs/contributing/howtos.md does not provide the command to execute this script, and the existing extraction commands mentioned in the documentation do not include this flag, meaning the comments are not being extracted as expected.

To resolve this, update the documentation to explicitly instruct developers to run the babel_update.sh script instead of running pybabel extract manually.

Would you like me to implement this documentation fix? I can also check the rest of the PR for other comments if you would like me to address them as well.

docs/developer_docs/contributing/howtos.md

Updating language files

./scripts/translations/babel_update.sh

Comment thread scripts/translations/babel_update.sh
@bito-code-review

bito-code-review Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #2c58ea

Actionable Suggestions - 0
Review Details
  • Files reviewed - 6 · Commit Range: 24c455c..24c455c
    • scripts/translations/babel_update.sh
    • superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx
    • superset-frontend/src/pages/DatabaseList/index.tsx
    • superset-frontend/src/utils/getChartRequiredFieldsMissingMessage.ts
    • superset/translations/messages.pot
    • superset/views/dashboard/mixin.py
  • Files skipped - 1
    • docs/developer_docs/contributing/howtos.md - Reason: Filter setting
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@bito-code-review

bito-code-review Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #29e96c

Actionable Suggestions - 0
Additional Suggestions - 3
  • tests/unit_tests/scripts/translations/check_pot_drift_test.py - 3
    • Duplicated POT test helpers · Line 152-160
      `_HEADER` (line 152) repeats the header literal already built inside `_pot` (line 48), and `_fake_extract_text` re-implements `_fake_extract` (`_fake_extract(m)` is equivalent to `_fake_extract_text(_pot(*m))`). Two copies of the fixture format can silently drift when the POT header or fake-run shape changes. Consider sharing one header constant and one extract-fake factory.
    • Missing return annotation · Line 155-155
      `_fake_extract_text` lacks a return annotation even though its nested `run` is annotated `-> MagicMock` and the sibling `_fake_extract` pattern shows the intent. BITO rule 12587 requires explicit return types on helper functions in test files. Annotate it `-> Callable[..., MagicMock]`.
    • Missing test docstrings · Line 177-177
      Six new tests lack docstrings: `test_diff_reports_a_reworded_i18n_comment`, `test_diff_reports_an_added_and_a_removed_i18n_comment`, `test_diff_ignores_rewrapping_an_i18n_comment`, `test_diff_ignores_the_stamped_do_not_translate_marker`, `test_stamped_comments_match_apply_do_not_translate_marker`, `test_main_exits_one_and_lists_changed_i18n_comments`. BITO rule 12148 requires a docstring per new test; the inline comment on the marker test does not substitute.
Review Details
  • Files reviewed - 4 · Commit Range: 1357bc4..7ccf383
    • scripts/translations/backfill_po.py
    • scripts/translations/check_pot_drift.py
    • tests/unit_tests/scripts/translations/backfill_po_test.py
    • tests/unit_tests/scripts/translations/check_pot_drift_test.py
  • Files skipped - 1
    • docs/developer_docs/contributing/howtos.md - Reason: Filter setting
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • 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 an incremental AI Review.

  • /review full - 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

…w tests

One POT header constant and one extract fake instead of two copies of
each; return annotations on both fake factories; docstrings on the six
comment-drift tests, matching the others this PR adds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bito-code-review

bito-code-review Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #448ac8

Actionable Suggestions - 0
Additional Suggestions - 1
  • tests/unit_tests/scripts/translations/check_pot_drift_test.py - 1
    • Missing helper docstring · Line 56-56
      `_fake_extract_text` is a newly added helper with no docstring. BITO.md adaptive rule 12147 requires an inline docstring on every new Python function, including test helpers. Add one-line docstring documenting the fake `pybabel extract` behavior.
Review Details
  • Files reviewed - 1 · Commit Range: 7ccf383..9018b16
    • tests/unit_tests/scripts/translations/check_pot_drift_test.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • 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 an incremental AI Review.

  • /review full - 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bito-code-review

bito-code-review Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #dd8355

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 9018b16..be9a7a7
    • tests/unit_tests/scripts/translations/check_pot_drift_test.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • 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 an incremental AI Review.

  • /review full - 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread scripts/translations/backfill_po.py
Comment thread superset-frontend/src/pages/DatabaseList/index.tsx Outdated
…mantic layers in the Backend note

An extracted comment now marks an entry do-not-translate only when it
carries the exact `do-not-translate` line apply_do_not_translate.py
stamps. The loose phrase match still applies to translator comments,
where the ru catalog's legacy "# Не переводить" marker lives. Without
this, an i18n: note such as "do not translate as the animal" made the
backfill skip the very entry it was meant to guide.

The Backend column also lists semantic-layer types when SEMANTIC_LAYERS
is enabled, so its note now names both. The template and all 30
catalogs carry the new wording, identical to what pybabel update writes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bito-code-review

bito-code-review Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #77e29f

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset/translations/ru/LC_MESSAGES/messages.po - 1
    • Translation contradicts meaning · Line 2754-2755
      The updated i18n comment clarifies "Backend" means a database engine or semantic layer, explicitly "not a server tier or a driver". The ru msgstr "Драйвер" (driver) directly contradicts this clarified meaning, while cs/ro/uk/zh/zh_TW align with it. Consider correcting the ru translation to match.
Review Details
  • Files reviewed - 34 · Commit Range: be9a7a7..4bbce5a
    • scripts/translations/backfill_po.py
    • superset-frontend/src/pages/DatabaseList/index.tsx
    • superset/translations/ar/LC_MESSAGES/messages.po
    • superset/translations/ca/LC_MESSAGES/messages.po
    • superset/translations/cs/LC_MESSAGES/messages.po
    • superset/translations/de/LC_MESSAGES/messages.po
    • superset/translations/en/LC_MESSAGES/messages.po
    • superset/translations/es/LC_MESSAGES/messages.po
    • superset/translations/fa/LC_MESSAGES/messages.po
    • superset/translations/fi/LC_MESSAGES/messages.po
    • superset/translations/fr/LC_MESSAGES/messages.po
    • superset/translations/it/LC_MESSAGES/messages.po
    • superset/translations/ja/LC_MESSAGES/messages.po
    • superset/translations/ko/LC_MESSAGES/messages.po
    • superset/translations/lv/LC_MESSAGES/messages.po
    • superset/translations/messages.pot
    • superset/translations/mi/LC_MESSAGES/messages.po
    • superset/translations/nl/LC_MESSAGES/messages.po
    • superset/translations/pl/LC_MESSAGES/messages.po
    • superset/translations/pt/LC_MESSAGES/messages.po
    • superset/translations/pt_BR/LC_MESSAGES/messages.po
    • superset/translations/ro/LC_MESSAGES/messages.po
    • superset/translations/ru/LC_MESSAGES/messages.po
    • superset/translations/sk/LC_MESSAGES/messages.po
    • superset/translations/sl/LC_MESSAGES/messages.po
    • superset/translations/sr/LC_MESSAGES/messages.po
    • superset/translations/sr_Latn/LC_MESSAGES/messages.po
    • superset/translations/ta/LC_MESSAGES/messages.po
    • superset/translations/th/LC_MESSAGES/messages.po
    • superset/translations/tr/LC_MESSAGES/messages.po
    • superset/translations/uk/LC_MESSAGES/messages.po
    • superset/translations/zh/LC_MESSAGES/messages.po
    • superset/translations/zh_TW/LC_MESSAGES/messages.po
    • tests/unit_tests/scripts/translations/backfill_po_test.py
  • Files skipped - 1
    • docs/developer_docs/contributing/howtos.md - Reason: Filter setting
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • 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 an incremental AI Review.

  • /review full - 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@codeant-ai-for-open-source

codeant-ai-for-open-source Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

CodeAnt PR Risk: Low Risk

  • The PR appears safe to merge; it carries tagged translator context into catalogs and backfill prompts.
  • Added tests cover comment extraction, catalog propagation, prompt handling, and detection of stale context in the translation template.

Assessed commit: eea7e18d2273

@glaterza

glaterza commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Re-triggered CI after the runner outage on d2ea494 (merged latest master, no conflicts); all checks green now. Ready to merge whenever you are. Thanks!

…r-context-comments

# Conflicts:
#	superset/translations/messages.pot
@glaterza

glaterza commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged latest master to resolve a messages.pot conflict (template regenerated from source; drift check passes). CI re-running.

if backfill_po._developer_note(entry)
}
assert expected["Backend"] == _BACKEND_NOTE
assert len(expected) == 4

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.

These two assertions pin the catalogs to exactly four notes and to the current Backend wording. Following the new howto and adding a fifth i18n: note (or rewording one), with the template and all catalogs regenerated in sync, would still fail CI here until someone edits this test. Should the fixed examples live in a fixture, with this check asserting only that every catalog carries each note the template does?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. 96d0540834 removes the pinned count and the pinned Backend wording, and it also covers a second case.

Most PRs commit only messages.pot. On master at 1cf9569807, every catalog lags the template by 18 msgids. A test that reads the committed catalogs fails for a contributor who adds a note this way. For a note on a new string, it failed with AttributeError.

The new test builds a template and a catalog in a temporary directory. It reads the pybabel update call from babel_update.sh, replaces only the -i and -d paths, and runs it. It then reads the note back. It covers an added, a reworded, a removed and a wrapped note. Adding -l fr to the script's update call fails all four cases. The PR description has the scenario matrix and the negative controls.

glaterza and others added 2 commits October 7, 2026 22:42
The committed-catalog test pinned four notes and the Backend wording.
A contributor who added a note per the howto failed CI.
Most upstream PRs commit only messages.pot, and catalogs lag it.
A test on the committed catalogs also failed that workflow.
For a note on a new string, it failed with AttributeError.

The new test builds a template and a catalog in a temporary directory.
It reads the pybabel update call from babel_update.sh and replaces only
the -i and -d paths. It then reads the note back with _developer_note.
It covers an added, a reworded, a removed and a wrapped note.
A change to the script's update flags that stops propagation fails it.
The drift check keeps the template in sync with the source.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@glaterza

glaterza commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Both playwright-tests-gaq jobs on 96d0540834 failed in "Import test data" with ImportError: module 'tests.integration_tests' has no attribute 'superset_test_config_gaq'. Master added that job and its config in #43004, after this branch last merged master. b149274b27 merges master c1908747b1, which contains the config, and the drift check still passes.

glaterza and others added 2 commits October 8, 2026 01:21
pybabel drops a note after a blank line, inside the call's parentheses,
or above a Python _( call whose string starts on the next line. It
publishes every comment line between the i18n: line and the call. The
howto and the babel_update.sh comment said that only tagged comments
are extracted, which is wrong for those lines.

The howto lists the placements and a grep to confirm a note landed. It
no longer says the backfill note takes precedence: in a live run the
note did not change the model's answer against unanimous references.
Updating language files points at babel_update.sh, because a bare
pybabel update leaves a python-format flag that msgfmt rejects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three note cases had no test that a plausible bug would fail. They are
a hyphenated do-not-translate in a note, a note on a plural entry, and
a new noted string. Each new case fails one mutation: a substring
marker match, a singular-only note, and a union of msgids in the
comment comparison.

The comment-drift tests stub extract_fresh instead of subprocess.run,
so they no longer snapshot the repository with git for each case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@glaterza

glaterza commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

@sadpandajoe, 96d0540834 answers your thread on backfill_po_test.py, and 49825ae856 adds three test cases from a self-review. I also corrected my earlier live-run numbers on the babel_update.sh thread. Could you take another look at those two threads?

@glaterza

glaterza commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

eea7e18d22 merges master to resolve the messages.pot and catalog conflicts from #44992. The catalogs still differ from master only by the four notes, and the drift check passes.

@hainenber

Copy link
Copy Markdown
Contributor

Thank you for persisting across several reviews, @glaterza. It's a LGTM!

@hainenber
hainenber merged commit 2918a7b into apache:master Oct 10, 2026
82 checks passed
@glaterza

Copy link
Copy Markdown
Contributor Author

Thank you, @hainenber, and thank you @sadpandajoe for the patience and the review rounds that shaped the tests and the docs.

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

Labels

doc Namespace | Anything related to documentation i18n:brazilian i18n:chinese Translation related to Chinese language i18n:czech i18n:dutch i18n:french Translation related to French 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:persian i18n:portuguese i18n:russian Translation related to Russian language i18n:slovak i18n:spanish Translation related to Spanish language i18n:traditional-chinese 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.

3 participants