This is an automated email from the ASF dual-hosted git repository.

sadpandajoe pushed a commit to branch ultraset-fix-44551-2
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 68cb880580568b00b139553b6c387022564f1650
Author: Joe Li <[email protected]>
AuthorDate: Wed Sep 23 23:57:29 2026 +0000

    fix(i18n): correct Slovak SQL Lab progress message placeholders
    
    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 <[email protected]>
---
 superset/translations/sk/LC_MESSAGES/messages.po   |  4 +-
 .../sk_sql_lab_progress_message_test.py            | 55 ++++++++++++++++++++++
 2 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/superset/translations/sk/LC_MESSAGES/messages.po 
b/superset/translations/sk/LC_MESSAGES/messages.po
index c67268245fd..481cbb55187 100644
--- a/superset/translations/sk/LC_MESSAGES/messages.po
+++ b/superset/translations/sk/LC_MESSAGES/messages.po
@@ -12760,9 +12760,9 @@ msgstr "Spustiť výber"
 msgid "Running"
 msgstr "Beží"
 
-#, fuzzy, python-format
+#, python-format
 msgid "Running block %(block_num)s out of %(block_count)s"
-msgstr "Spouští sa príkaz %(statement_num)s z %(statement_count)s"
+msgstr "Spúšťa sa blok %(block_num)s z %(block_count)s"
 
 msgid "SAT"
 msgstr "SO"
diff --git a/tests/unit_tests/translations/sk_sql_lab_progress_message_test.py 
b/tests/unit_tests/translations/sk_sql_lab_progress_message_test.py
new file mode 100644
index 00000000000..cebecc8f1a8
--- /dev/null
+++ b/tests/unit_tests/translations/sk_sql_lab_progress_message_test.py
@@ -0,0 +1,55 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+Regression test for https://github.com/apache/superset/issues/44551.
+
+``superset/sql_lab.py`` formats the SQL Lab progress message with
+``block_num``/``block_count`` keyword arguments (see ``sql_lab.py`` around the
+``"Running block %(block_num)s out of %(block_count)s"`` call). If a
+translation's ``msgstr`` references a placeholder name that isn't one of
+those two keywords, ``flask_babel.gettext`` raises a ``KeyError`` when
+formatting it, and every SQL Lab query fails in that locale.
+"""
+
+import re
+
+import polib  # type: ignore[import-untyped]
+
+_MSGID = "Running block %(block_num)s out of %(block_count)s"
+_PLACEHOLDER_RE = re.compile(r"%\((\w+)\)s")
+
+
+def _placeholder_names(text: str) -> set[str]:
+    return set(_PLACEHOLDER_RE.findall(text))
+
+
+def test_sk_progress_message_placeholders_match_source() -> None:
+    catalog = polib.pofile("superset/translations/sk/LC_MESSAGES/messages.po")
+    entry = catalog.find(_MSGID)
+
+    assert entry is not None, f"msgid not found in sk catalog: {_MSGID!r}"
+
+    source_placeholders = _placeholder_names(entry.msgid)
+    translated_placeholders = _placeholder_names(entry.msgstr)
+
+    assert translated_placeholders <= source_placeholders, (
+        "sk translation references placeholder(s) "
+        f"{translated_placeholders - source_placeholders} that are not in the "
+        f"English source {source_placeholders} -- formatting this msgstr with "
+        "the block_num/block_count kwargs sql_lab.py actually passes raises "
+        "KeyError and fails every SQL Lab query in the sk locale"
+    )

Reply via email to