Skip to content

Commit 142986c

Browse files
authored
Merge pull request #104 from PyCampES/make-script-issue-nicer
2 parents 6927e71 + 235e72b commit 142986c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

scripts/create_issue.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
11
import os
22
import sys
3+
from pathlib import Path
34

4-
import polib
55
from github import Github
6-
6+
from potodo._po_file import PoFileStats
77

88
if len(sys.argv) != 2:
99
print('Specify PO filename')
1010
sys.exit(1)
1111

1212
pofilename = sys.argv[1]
13-
percentage = polib.pofile(pofilename).percent_translated()
13+
pofile = PoFileStats(Path(pofilename))
1414

1515
g = Github(os.environ.get('GITHUB_TOKEN'))
1616

1717
repo = g.get_repo('PyCampES/python-docs-es')
1818
# https://pygithub.readthedocs.io/en/latest/github_objects/Repository.html#github.Repository.Repository.create_issue
1919
issue = repo.create_issue(
2020
title=f'Translate `{pofilename}`',
21-
body=f'''This file is at {percentage}% translated. It needs to reach 100% translated.
21+
body=f'''This needs to reach 100% translated.
22+
23+
Current stats for `{pofilename}`:
24+
25+
- Fuzzy: {pofile.fuzzy_nb}
26+
- Percent translated: {pofile.percent_translated}%
27+
- Entries: {pofile.translated_nb} / {pofile.po_file_size}
28+
- Untranslated: {pofile.untranslated_nb}
2229
2330
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.
2431
25-
Remember to follow the steps in our [Contributing Guide](https://python-docs-es.readthedocs.io/page/CONTRIBUTING.html)''',
32+
Remember to follow the steps in our [Contributing Guide](https://python-docs-es.readthedocs.io/page/CONTRIBUTING.html).''',
2633
)
2734
print(f'Issue created at {issue.html_url}')

0 commit comments

Comments
 (0)