From db841f3a1dde2a0822f4f389c36b23aa45073efd Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 6 May 2020 23:46:19 +0200 Subject: [PATCH] Make script nicer --- scripts/create_issue.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/create_issue.py b/scripts/create_issue.py index 331eedd353..539f87dca0 100644 --- a/scripts/create_issue.py +++ b/scripts/create_issue.py @@ -1,16 +1,16 @@ import os import sys +from pathlib import Path -import polib from github import Github - +from potodo._po_file import PoFileStats if len(sys.argv) != 2: print('Specify PO filename') sys.exit(1) pofilename = sys.argv[1] -percentage = polib.pofile(pofilename).percent_translated() +pofile = PoFileStats(Path(pofilename)) g = Github(os.environ.get('GITHUB_TOKEN')) @@ -18,10 +18,17 @@ # https://pygithub.readthedocs.io/en/latest/github_objects/Repository.html#github.Repository.Repository.create_issue issue = repo.create_issue( title=f'Translate `{pofilename}`', - body=f'''This file is at {percentage}% translated. It needs to reach 100% translated. + body=f'''This needs to reach 100% translated. + +Current stats for `{pofilename}`: + +- Fuzzy: {pofile.fuzzy_nb} +- Percent translated: {pofile.percent_translated}% +- Entries: {pofile.translated_nb} / {pofile.po_file_size} +- Untranslated: {pofile.untranslated_nb} Please, comment here if you want this file to be assigned to you and an member will assign it to you as soon as possible, so you can start working on it. -Remember to follow the steps in our [Contributing Guide](https://python-docs-es.readthedocs.io/es/3.7/CONTRIBUTING.html)''', +Remember to follow the steps in our [Contributing Guide](https://python-docs-es.readthedocs.io/page/CONTRIBUTING.html).''', ) print(f'Issue created at {issue.html_url}')