Skip to content

fix(i18n): correct Slovak SQL Lab progress message placeholders - #44587

Merged
rusackas merged 2 commits into
masterfrom
ultraset-fix-44551-2
Sep 28, 2026
Merged

rusackas merged 2 commits into
masterfrom
ultraset-fix-44551-2

Conversation

@sadpandajoe

Copy link
Copy Markdown
Member

SUMMARY

Every SQL Lab query fails with a 500 when the UI language is Slovak.

superset/sql_lab.py:587-591 renders the per-statement progress message with
gettext("Running block %(block_num)s out of %(block_count)s", block_num=..., block_count=...).
The Slovak catalog translated that msgid as
"Spouští sa príkaz %(statement_num)s z %(statement_count)s" — the msgstr
referenced statement_num/statement_count, placeholder names the caller does
not pass, so formatting it raised KeyError('statement_num') on every
statement.

Introduced by 5549100 ("feat(i18n): add missing Slovak translations",
#40219). The msgid itself had been renamed from statement_* to block_* a
year earlier in cf31538 ("feat(sqllab): use sqlglot instead of sqlparse",
#33542), at which point the Slovak entry was still empty; #40219 then backfilled
it with a Czech-derived string that carried the pre-rename placeholder names.

The entry was marked #, fuzzy, but that does not make it inert: Dockerfile:168
compiles catalogs with pybabel compile --use-fuzzy, so the broken msgstr ships
and is used.

This corrects the msgstr to "Spúšťa sa blok %(block_num)s z %(block_count)s" —
matching both the placeholders the caller passes and the terminology of the
sibling entry already in the Slovak catalog, "Block %(block_num)s out of %(block_count)s" → "Blok %(block_num)s z %(block_count)s" — and drops the now
inaccurate fuzzy flag. A regression test asserts the Slovak msgstr's
placeholder set is a subset of the English source's.

This is the same defect class already fixed for French (#38468) and Czech
(#40165). Issue #44551 reports it in 19 further locales; this PR deliberately
fixes only Slovak, the locale with a confirmed reproduction, rather than
bundling a multi-language sweep into one change.

TESTING INSTRUCTIONS

  1. Set the UI language to Slovak (sk) — either via the language picker, or by
    setting BABEL_DEFAULT_LOCALE = "sk" in superset_config.py.
  2. Make sure the translations are compiled with fuzzy entries included, as the
    Docker image does: pybabel compile --use-fuzzy -d superset/translations.
  3. Open SQL Lab and run any query, e.g. SELECT 1.
  4. Before this change the query fails with a 500 and the logs show
    KeyError: 'statement_num'. After it, the query succeeds and the progress
    message reads "Spúšťa sa blok 1 z 1".

ADDITIONAL INFORMATION

🤖 Generated with Claude Code

sadpandajoe and others added 2 commits September 23, 2026 23:57
The sk catalog's msgstr for "Running block %(block_num)s out of
%(block_count)s" still used the pre-rename placeholder names
%(statement_num)s/%(statement_count)s. superset/sql_lab.py formats this
string with block_num/block_count for every SQL Lab statement, so
flask_babel.gettext raised KeyError('statement_num') and every query
failed in the Slovak locale. Same bug class as #38468 (French) and
#40165 (Czech).

Fixes #44551

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The regression test resolved the catalog through a bare relative path, so
it only worked when pytest was invoked from the repository root. polib
treats an unreadable path as inline .po content, so from any other working
directory the test failed with a misleading "Syntax error in po file
(line 1)" instead of finding the catalog.

Resolve the path from __file__, matching
tests/unit_tests/scripts/translations/backfill_po_test.py.

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

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

Copy link
Copy Markdown
Contributor

Code Review Agent Run #21afd5

Actionable Suggestions - 0
Additional Suggestions - 1
  • tests/unit_tests/translations/sk_sql_lab_progress_message_test.py - 1
    • Regex misses non-s conversions · Line 41-41
      The regex `%(\(\w+\)s` only captures `%(name)s` conversions. A translation like `%(foo)d` or `%(foo)r` (name not in source) would evade it, so the test passes even though formatting with `block_num`/`block_count` kwargs still raises `KeyError`. Use `%(\(\w+\)` to match all named specifiers.
Review Details
  • Files reviewed - 2 · Commit Range: 68cb880..c91ee9c
    • superset/translations/sk/LC_MESSAGES/messages.po
    • tests/unit_tests/translations/sk_sql_lab_progress_message_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

@github-actions github-actions Bot added i18n Namespace | Anything related to localization i18n:slovak labels Sep 24, 2026
@codecov

codecov Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.07%. Comparing base (8141d66) to head (c91ee9c).

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #44587       +/-   ##
===========================================
+ Coverage   57.12%   81.07%   +23.95%     
===========================================
  Files        2955     2955               
  Lines      178331   178331               
  Branches    41313    41313               
===========================================
+ Hits       101864   144575    +42711     
+ Misses      75487    31046    -44441     
- Partials      980     2710     +1730     
Flag Coverage Δ
hive 36.79% <ø> (ø)
mysql 55.98% <ø> (?)
postgres 55.99% <ø> (?)
presto 38.69% <ø> (ø)
python 85.37% <ø> (+46.63%) ⬆️
sqlite 55.71% <ø> (?)
unit 77.64% <ø> (?)

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.

glaterza added a commit to glaterza/superset that referenced this pull request Sep 24, 2026
These translations carry placeholders that do not match their English
source, so none of them can format. At runtime they raise an exception,
show a literal placeholder such as "Error: %s", drop a value, show a blank
one, or fail silently because the frontend Translator catches the error and
returns the English key.

Superset serves fuzzy translations on purpose, so a broken fuzzy entry is
as live as a confirmed one: `pybabel compile --use-fuzzy` reports 1,090
errors and still writes every .mo file, and po2json.sh passes --fuzzy.

Clearing the msgstr makes each entry untranslated, so the UI falls back to
the English source with its values. Confirmed (non-fuzzy) translations are
untouched; the 8 broken confirmed entries are fixed by hand separately.

The Slovak SQL Lab progress message is deliberately left alone: apache#44587
rewrites that entry properly and promotes it out of fuzzy, so this change
stays clear of it.

The 97 entries that carried a `Machine-translated via backfill_po.py`
attribution lose it along with the translation it described, so they read
as plainly untranslated and backfill_po.py sees clean candidates.

Measured at master 2ac6e24, across 18 catalogs:

- compile errors under --use-fuzzy: 1,090 -> 155
- 36 of the 37 entries that raised now format cleanly (the 37th is apache#44587's)
- placeholder checker findings: 1,227 -> 38
- check_translation_regression.py: no regressions; confirmed-translation
  counts unchanged in all 29 catalogs, fuzzy down exactly 1,189

Refs: apache#44551
@glaterza

Copy link
Copy Markdown
Contributor

Thanks for picking this one up — this is the SQL Lab case from #44551.

Heads-up on an overlap, and what I did about it: #44611 clears the fuzzy translations whose placeholders cannot format, and the Slovak Running block %(block_num)s out of %(block_count)s entry was in that set. Your fix is the better outcome for it — a correct Slovak translation beats falling back to English — so I removed that entry from my PR. The two changes are now independent and can land in either order without touching the same lines.

One thing worth knowing for the test you added: the same defect class exists in 17 other languages for other strings, 36 of which raise on the backend. A check that covers every catalog and every msgid is PR 1 of the plan in #44551, and it flags 1,227 entries on master today. Happy to shape it around your test if you would rather have one mechanism than two.

@sadpandajoe

Copy link
Copy Markdown
Member Author

@glaterza since you are working on something similar, feel free to review my pr also.

@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.

LGTM

@rusackas
rusackas merged commit c9455b2 into master Sep 28, 2026
81 checks passed
@rusackas
rusackas deleted the ultraset-fix-44551-2 branch September 28, 2026 17:31
hainenber pushed a commit that referenced this pull request Sep 29, 2026
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
villebro pushed a commit that referenced this pull request Sep 30, 2026
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
(cherry picked from commit c9455b2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

i18n:slovak i18n Namespace | Anything related to localization size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

i18n: 1,198 translations have broken placeholders (SQL Lab fails in Slovak, 500 errors, raw %s in the UI)

3 participants