bito-code-review[bot] commented on code in PR #41465:
URL: https://github.com/apache/superset/pull/41465#discussion_r3485678959


##########
scripts/translations/build_translation_index.py:
##########
@@ -86,7 +86,17 @@ def build_index(translations_dir: Path) -> dict[str, Any]:
 
     for lang in langs:
         po_path = translations_dir / lang / "LC_MESSAGES" / "messages.po"
-        cat = polib.pofile(str(po_path))
+        try:
+            cat = polib.pofile(str(po_path))
+        except OSError as exc:
+            # A single malformed catalog (e.g. an unescaped quote) shouldn't
+            # block backfilling every other language. Skip it with a loud
+            # warning so the corrupt file gets fixed separately.
+            print(
+                f"WARNING: skipping {lang} — could not parse {po_path}: {exc}",
+                file=sys.stderr,
+            )
+            continue

Review Comment:
   <!-- Bito Reply -->
   The reviewer suggested adding a test case to ensure that the new 
error-handling block correctly skips malformed PO files without interrupting 
the indexing of other valid languages. This is a valid suggestion to improve 
test coverage and prevent future regressions in the error-handling logic.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to