|
1 | 1 | import os
|
2 | 2 | import sys
|
| 3 | +from pathlib import Path |
3 | 4 |
|
4 |
| -import polib |
5 | 5 | from github import Github
|
6 |
| - |
| 6 | +from potodo._po_file import PoFileStats |
7 | 7 |
|
8 | 8 | if len(sys.argv) != 2:
|
9 | 9 | print('Specify PO filename')
|
10 | 10 | sys.exit(1)
|
11 | 11 |
|
12 | 12 | pofilename = sys.argv[1]
|
13 |
| -percentage = polib.pofile(pofilename).percent_translated() |
| 13 | +pofile = PoFileStats(Path(pofilename)) |
14 | 14 |
|
15 | 15 | g = Github(os.environ.get('GITHUB_TOKEN'))
|
16 | 16 |
|
17 | 17 | repo = g.get_repo('PyCampES/python-docs-es')
|
18 | 18 | # https://pygithub.readthedocs.io/en/latest/github_objects/Repository.html#github.Repository.Repository.create_issue
|
19 | 19 | issue = repo.create_issue(
|
20 | 20 | 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} |
22 | 29 |
|
23 | 30 | 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.
|
24 | 31 |
|
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).''', |
26 | 33 | )
|
27 | 34 | print(f'Issue created at {issue.html_url}')
|
0 commit comments