Skip to content

Commit 2f1f402

Browse files
committed
Enhance todo list display.
1 parent 3cb3ca3 commit 2f1f402

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

scripts/todo.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,42 @@ def main():
2020
issue["title"].split()[-1]: issue["user"]["login"] for issue in issues
2121
}
2222

23-
po_files = list(Path(".").glob("**/*.po"))
23+
po_files = [file for file in Path(".").glob("**/*.po") if ".git/" not in str(file)]
2424

2525
po_files_per_directory = {
2626
path.parent.name: set(path.parent.glob("*.po")) for path in po_files
2727
}
2828

2929
for directory, po_files in sorted(po_files_per_directory.items()):
30-
print("\n\n# " + directory)
30+
buffer = []
3131
folder_stats = []
3232
for po_file in sorted(po_files):
3333
stats = polib.pofile(po_file)
3434
po_file_stat = stats.percent_translated()
3535
if po_file_stat == 100:
3636
folder_stats.append(po_file_stat)
3737
continue
38-
print(
39-
f"{po_file.name:<30}",
40-
f"{len(stats.translated_entries()):3d} / {len(stats):3d}",
41-
f"({po_file_stat:5.1f}% translated)",
42-
f"{len(stats.fuzzy_entries())} fuzzy" if stats.fuzzy_entries() else "",
43-
f"Réservé par {reservations[str(po_file)]}"
44-
if str(po_file) in reservations
45-
else "",
38+
buffer.append(
39+
f"- {po_file.name:<30} "
40+
+ f"{len(stats.translated_entries()):3d} / {len(stats):3d} "
41+
+ f"({po_file_stat:5.1f}% translated)"
42+
+ (
43+
f", {len(stats.fuzzy_entries())} fuzzy"
44+
if stats.fuzzy_entries()
45+
else ""
46+
)
47+
+ (
48+
f", réservé par {reservations[str(po_file)]}"
49+
if str(po_file) in reservations
50+
else ""
51+
)
4652
)
4753
folder_stats.append(po_file_stat)
48-
# TODO: Have the percentage printed next to the folder name
49-
print("\n{}% done.".format(round(statistics.mean(folder_stats), 2)))
54+
print(f"\n\n# {directory} ({statistics.mean(folder_stats):.2f}% done)\n")
55+
print("\n".join(buffer))
5056

5157

52-
if __name__ == '__main__':
58+
if __name__ == "__main__":
5359
# TODO: Add PR handling
5460
# TODO: Add total from all folders
5561
main()

0 commit comments

Comments
 (0)