From b1ee9bad47890c90a3ab849d393e4064bf24736f Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Mon, 20 Oct 2025 21:31:41 +0200 Subject: [PATCH] List missing translations in issue body --- tools/check_po.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tools/check_po.py b/tools/check_po.py index 67064ec8..3f2109cd 100755 --- a/tools/check_po.py +++ b/tools/check_po.py @@ -77,7 +77,7 @@ if __name__ == "__main__": dashboard_ref = polib.pofile(dashboard_pot) for lang in args.lang: - lang_issues = 0 + lang_issues = dict() for po_ref, po in ((client_ref, os.path.join(locale_dir, lang, "wivrn.po")), (dashboard_ref, os.path.join(locale_dir, lang, "wivrn-dashboard.po"))): if not os.path.exists(po): @@ -92,22 +92,33 @@ if __name__ == "__main__": if not i.msgid in entries: missing = missing + 1 print(f"::notice file={po}::{lang} translation for {repr(i.msgid)} is missing") - lang_issues += missing + + if not po in lang_issues: + lang_issues[po] = [] + lang_issues[po].append(repr(i.msgid)) if missing > 0: print(f"::warning file={po}::{lang} {missing} translations missing") if args.manage_issues: issues = [i for i in repo.get_issues(state="all", labels = [ISSUE_LABEL]) if i.title == ISSUE_TITLE.format(lang=lang)] - if lang_issues > 0: + + issue_body = 'The following translations are missing:\n' + for po in lang_issues: + issue_body += '\n## ' + pathlib.Path(po).name + '\n' + for msg in lang_issues[po]: + issue_body += '- ' + msg + '\n' + + if len(lang_issues) > 0: if issues: for issue in issues: - if issue.state != "open": - issue.edit(state="open") + if issue.state != "open" or issue.body != issue_body: + issue.edit(state="open", body=issue_body) else: try: repo.create_issue( title=ISSUE_TITLE.format(lang=lang), + body=issue_body, labels=[ISSUE_LABEL] ) except GithubException as e: @@ -116,4 +127,4 @@ if __name__ == "__main__": raise else: for issue in issues: - issue.edit(state="closed") + issue.edit(state="closed", body="All translations are up to date")