Merge remote-tracking branch 'upstream/master'
This commit is contained in:
+17
-6
@@ -77,7 +77,7 @@ if __name__ == "__main__":
|
|||||||
dashboard_ref = polib.pofile(dashboard_pot)
|
dashboard_ref = polib.pofile(dashboard_pot)
|
||||||
|
|
||||||
for lang in args.lang:
|
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")),
|
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"))):
|
(dashboard_ref, os.path.join(locale_dir, lang, "wivrn-dashboard.po"))):
|
||||||
if not os.path.exists(po):
|
if not os.path.exists(po):
|
||||||
@@ -92,22 +92,33 @@ if __name__ == "__main__":
|
|||||||
if not i.msgid in entries:
|
if not i.msgid in entries:
|
||||||
missing = missing + 1
|
missing = missing + 1
|
||||||
print(f"::notice file={po}::{lang} translation for {repr(i.msgid)} is missing")
|
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:
|
if missing > 0:
|
||||||
print(f"::warning file={po}::{lang} {missing} translations missing")
|
print(f"::warning file={po}::{lang} {missing} translations missing")
|
||||||
|
|
||||||
if args.manage_issues:
|
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)]
|
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:
|
if issues:
|
||||||
for issue in issues:
|
for issue in issues:
|
||||||
if issue.state != "open":
|
if issue.state != "open" or issue.body != issue_body:
|
||||||
issue.edit(state="open")
|
issue.edit(state="open", body=issue_body)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
repo.create_issue(
|
repo.create_issue(
|
||||||
title=ISSUE_TITLE.format(lang=lang),
|
title=ISSUE_TITLE.format(lang=lang),
|
||||||
|
body=issue_body,
|
||||||
labels=[ISSUE_LABEL]
|
labels=[ISSUE_LABEL]
|
||||||
)
|
)
|
||||||
except GithubException as e:
|
except GithubException as e:
|
||||||
@@ -116,4 +127,4 @@ if __name__ == "__main__":
|
|||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
for issue in issues:
|
for issue in issues:
|
||||||
issue.edit(state="closed")
|
issue.edit(state="closed", body="All translations are up to date")
|
||||||
|
|||||||
Reference in New Issue
Block a user