rusackas commented on code in PR #41465:
URL: https://github.com/apache/superset/pull/41465#discussion_r3485678787
##########
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:
Added `test_build_index_skips_unparseable_catalog` — writes a corrupt
catalog next to a valid one and asserts the valid language still gets indexed.
--
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]