mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 05:09:11 +00:00
Co-authored-by: Diptanil Saha <diptanil@frappe.io> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> fix branch base and per-language commits in sync-hotfix-translations (#55405)
This commit is contained in:
7
.github/helper/merge_po_files.py
vendored
7
.github/helper/merge_po_files.py
vendored
@@ -7,7 +7,7 @@ Merge rules:
|
||||
b. language not yet in hotfix → copy file as-is (bench will filter to main.pot)
|
||||
c. msgid present in both → use develop's msgstr
|
||||
"""
|
||||
import shutil
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
from babel.messages.pofile import read_po, write_po
|
||||
@@ -24,7 +24,9 @@ for src in sorted(DEVELOP.glob("*.po")):
|
||||
dev = read_po(f)
|
||||
|
||||
if not dst.exists():
|
||||
shutil.copy(src, dst)
|
||||
dev.revision_date = datetime.now(timezone.utc)
|
||||
with dst.open("wb") as f:
|
||||
write_po(f, dev)
|
||||
added += 1
|
||||
print(f" [new] {src.name}")
|
||||
continue
|
||||
@@ -39,6 +41,7 @@ for src in sorted(DEVELOP.glob("*.po")):
|
||||
changes += 1
|
||||
|
||||
if changes:
|
||||
hf.revision_date = datetime.now(timezone.utc)
|
||||
with dst.open("wb") as f:
|
||||
write_po(f, hf)
|
||||
updated += 1
|
||||
|
||||
Reference in New Issue
Block a user