Repository navigation
fix(i18n): correct Slovak SQL Lab progress message placeholders - #44587
Conversation
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>
Code Review Agent Run #21afd5Actionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
|
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 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. |
|
@glaterza since you are working on something similar, feel free to review my pr also. |
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> (cherry picked from commit c9455b2)
SUMMARY
Every SQL Lab query fails with a 500 when the UI language is Slovak.
superset/sql_lab.py:587-591renders the per-statement progress message withgettext("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 msgstrreferenced
statement_num/statement_count, placeholder names the caller doesnot pass, so formatting it raised
KeyError('statement_num')on everystatement.
Introduced by 5549100 ("feat(i18n): add missing Slovak translations",
#40219). The msgid itself had been renamed from
statement_*toblock_*ayear 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:168compiles catalogs with
pybabel compile --use-fuzzy, so the broken msgstr shipsand 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 nowinaccurate
fuzzyflag. A regression test asserts the Slovak msgstr'splaceholder 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
sk) — either via the language picker, or bysetting
BABEL_DEFAULT_LOCALE = "sk"insuperset_config.py.Docker image does:
pybabel compile --use-fuzzy -d superset/translations.SELECT 1.KeyError: 'statement_num'. After it, the query succeeds and the progressmessage reads "Spúšťa sa blok 1 z 1".
ADDITIONAL INFORMATION
🤖 Generated with Claude Code