mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-09-14 10:47:36 +00:00
Persist partial i18n progress on transient translator failures
This commit is contained in:
@@ -316,7 +316,8 @@ def main() -> int:
|
|||||||
|
|
||||||
if total_failures:
|
if total_failures:
|
||||||
print(
|
print(
|
||||||
f"\nCompleted with {len(total_failures)} translation failures.",
|
f"\nCompleted with {len(total_failures)} translation failures "
|
||||||
|
f"(partial progress persisted, next run will retry).",
|
||||||
file=sys.stderr,
|
file=sys.stderr,
|
||||||
flush=True,
|
flush=True,
|
||||||
)
|
)
|
||||||
@@ -324,7 +325,14 @@ def main() -> int:
|
|||||||
print(f" - {lang}: {key} → {error}", file=sys.stderr, flush=True)
|
print(f" - {lang}: {key} → {error}", file=sys.stderr, flush=True)
|
||||||
if len(total_failures) > 20:
|
if len(total_failures) > 20:
|
||||||
print(f" ... and {len(total_failures) - 20} more.", file=sys.stderr, flush=True)
|
print(f" ... and {len(total_failures) - 20} more.", file=sys.stderr, flush=True)
|
||||||
return 2
|
# Exit 0 on partial failure so the workflow's Commit + push
|
||||||
|
# step still runs and the keys that DID translate reach
|
||||||
|
# develop. The un-translated keys stay empty and the next
|
||||||
|
# workflow tick (or a manual dispatch) retries them.
|
||||||
|
# Previously we returned 2, which failed the whole run and
|
||||||
|
# discarded 36 out of 38 successful translations because
|
||||||
|
# 2 googletrans timeouts hit sv at the start of the burst.
|
||||||
|
return 0
|
||||||
|
|
||||||
print("\ni18n messages generated successfully.", flush=True)
|
print("\ni18n messages generated successfully.", flush=True)
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -388,12 +388,20 @@ def main() -> int:
|
|||||||
write_language_cache(output_dir / f"{lang}.json", cache)
|
write_language_cache(output_dir / f"{lang}.json", cache)
|
||||||
|
|
||||||
if failures:
|
if failures:
|
||||||
print(f"Completed with {len(failures)} translation failures.", file=sys.stderr, flush=True)
|
print(
|
||||||
|
f"Completed with {len(failures)} translation failures "
|
||||||
|
f"(partial progress persisted, next run will retry).",
|
||||||
|
file=sys.stderr, flush=True,
|
||||||
|
)
|
||||||
for text, lang, error in failures[:20]:
|
for text, lang, error in failures[:20]:
|
||||||
print(f"- {lang}: {text[:80]} -> {error}", file=sys.stderr, flush=True)
|
print(f"- {lang}: {text[:80]} -> {error}", file=sys.stderr, flush=True)
|
||||||
if len(failures) > 20:
|
if len(failures) > 20:
|
||||||
print(f"... and {len(failures) - 20} more.", file=sys.stderr, flush=True)
|
print(f"... and {len(failures) - 20} more.", file=sys.stderr, flush=True)
|
||||||
return 2
|
# Exit 0 on partial failure so the workflow's Commit + push
|
||||||
|
# step still runs. Otherwise a couple of transient googletrans
|
||||||
|
# timeouts would fail the whole workflow and discard every
|
||||||
|
# successful translation from the same batch.
|
||||||
|
return 0
|
||||||
|
|
||||||
print("Translation cache generated successfully.", flush=True)
|
print("Translation cache generated successfully.", flush=True)
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -24,11 +24,15 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: [develop]
|
branches: [develop]
|
||||||
paths:
|
paths:
|
||||||
# `**/common.json` catches every locale, not just en/. Needed
|
# Only en/ triggers the run — it's the source of truth. Other
|
||||||
# because manual edits to sk/sv (or any curated locale) that
|
# locales are destinations, and the bot auto-commits them at
|
||||||
# empty a key so the workflow refills it wouldn't otherwise
|
# the end of every run; if they were in the trigger too, each
|
||||||
# trigger the job when en/ hasn't changed.
|
# auto-commit would fire another (empty) run.
|
||||||
- 'AppImage/messages/**/common.json'
|
# Manual edits to a curated locale that empty a key for the
|
||||||
|
# workflow to refill are the exception — dispatch this
|
||||||
|
# workflow manually from Actions in that case, or piggy-back
|
||||||
|
# a trivial en/ change onto the commit.
|
||||||
|
- 'AppImage/messages/en/common.json'
|
||||||
- '.github/scripts/build_i18n_messages.py'
|
- '.github/scripts/build_i18n_messages.py'
|
||||||
- '.github/workflows/build-i18n-messages.yml'
|
- '.github/workflows/build-i18n-messages.yml'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|||||||
Reference in New Issue
Block a user