|
| 1 | +# Use together with `pageviews.py` |
| 2 | +# python scripts/pageviews.py | head -n 150 | grep -v whats | cut -d ' ' -f 2 | sed 's/\.html/\.po/g' | xargs -I '{}' python scripts/create_issue.py '{}' |
| 3 | + |
1 | 4 | importos
|
2 | 5 | importsys
|
3 | 6 | frompathlibimportPath
|
|
17 | 20 | repo=g.get_repo('PyCampES/python-docs-es')
|
18 | 21 |
|
19 | 22 |
|
20 |
| -issues=repo.get_issues(state='open') |
| 23 | +issues=repo.get_issues(state='all') |
21 | 24 | forissueinissues:
|
22 | 25 | ifpofilenameinissue.title:
|
| 26 | + |
| 27 | +print(f'Skipping{pofilename}. There is a similar issue already created at{issue.html_url}') |
| 28 | +sys.exit(1) |
| 29 | + |
23 | 30 | msg=f'There is a similar issue already created at{issue.html_url}.\nDo you want to create it anyways? [y/N] '
|
24 | 31 | answer=input(msg)
|
25 | 32 | ifanswer!='y':
|
26 | 33 | sys.exit(1)
|
27 | 34 |
|
| 35 | +ifany([ |
| 36 | +pofile.translated_nb==pofile.po_file_size, |
| 37 | +pofile.untranslated_nb==0, |
| 38 | +]): |
| 39 | +print(f'Skipping{pofilename}. The file is 100% translated already.') |
| 40 | +sys.exit(1) |
| 41 | + |
28 | 42 | # https://pygithub.readthedocs.io/en/latest/github_objects/Repository.html#github.Repository.Repository.create_issue
|
| 43 | +title=f'Translate `{pofilename}`' |
29 | 44 | issue=repo.create_issue(
|
30 |
| -title=f'Translate `{pofilename}`', |
| 45 | +title=title, |
31 | 46 | body=f'''This needs to reach 100% translated.
|
32 | 47 |
|
33 | 48 | Current stats for `{pofilename}`:
|
|
41 | 56 |
|
42 | 57 | Remember to follow the steps in our [Contributing Guide](https://python-docs-es.readthedocs.io/page/CONTRIBUTING.html).''',
|
43 | 58 | )
|
44 |
| -print(f'Issue created at{issue.html_url}') |
| 59 | +print(f'Issue"{title}"created at{issue.html_url}') |