forked from AFPy/python-docs-fr
Enhance todo list display.
This commit is contained in:
parent
3cb3ca3dd8
commit
2f1f402b51
|
@ -20,14 +20,14 @@ def main():
|
|||
issue["title"].split()[-1]: issue["user"]["login"] for issue in issues
|
||||
}
|
||||
|
||||
po_files = list(Path(".").glob("**/*.po"))
|
||||
po_files = [file for file in Path(".").glob("**/*.po") if ".git/" not in str(file)]
|
||||
|
||||
po_files_per_directory = {
|
||||
path.parent.name: set(path.parent.glob("*.po")) for path in po_files
|
||||
}
|
||||
|
||||
for directory, po_files in sorted(po_files_per_directory.items()):
|
||||
print("\n\n# " + directory)
|
||||
buffer = []
|
||||
folder_stats = []
|
||||
for po_file in sorted(po_files):
|
||||
stats = polib.pofile(po_file)
|
||||
|
@ -35,21 +35,27 @@ def main():
|
|||
if po_file_stat == 100:
|
||||
folder_stats.append(po_file_stat)
|
||||
continue
|
||||
print(
|
||||
f"{po_file.name:<30}",
|
||||
f"{len(stats.translated_entries()):3d} / {len(stats):3d}",
|
||||
f"({po_file_stat:5.1f}% translated)",
|
||||
f"{len(stats.fuzzy_entries())} fuzzy" if stats.fuzzy_entries() else "",
|
||||
f"Réservé par {reservations[str(po_file)]}"
|
||||
if str(po_file) in reservations
|
||||
else "",
|
||||
buffer.append(
|
||||
f"- {po_file.name:<30} "
|
||||
+ f"{len(stats.translated_entries()):3d} / {len(stats):3d} "
|
||||
+ f"({po_file_stat:5.1f}% translated)"
|
||||
+ (
|
||||
f", {len(stats.fuzzy_entries())} fuzzy"
|
||||
if stats.fuzzy_entries()
|
||||
else ""
|
||||
)
|
||||
+ (
|
||||
f", réservé par {reservations[str(po_file)]}"
|
||||
if str(po_file) in reservations
|
||||
else ""
|
||||
)
|
||||
)
|
||||
folder_stats.append(po_file_stat)
|
||||
# TODO: Have the percentage printed next to the folder name
|
||||
print("\n{}% done.".format(round(statistics.mean(folder_stats), 2)))
|
||||
print(f"\n\n# {directory} ({statistics.mean(folder_stats):.2f}% done)\n")
|
||||
print("\n".join(buffer))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
# TODO: Add PR handling
|
||||
# TODO: Add total from all folders
|
||||
main()
|
||||
|
|
Loading…
Reference in New Issue
Block a user