@@ -38,6 +38,7 @@ def file_stats(path: Path):
3838def build_table () -> str :
3939 files = sorted (REPO_ROOT .rglob ("*.po" ))
4040 rows = []
41+ totals = {"translated" : 0 , "fuzzy" : 0 , "untranslated" : 0 }
4142 for f in files :
4243 if ".cpython-src" in f .parts or ".git" in f .parts :
4344 continue
@@ -46,17 +47,32 @@ def build_table() -> str:
4647 translated_pct = (t / total * 100 ) if total else 100.0
4748 fuzzy_pct = (fz / total * 100 ) if total else 0.0
4849 rel = f .relative_to (REPO_ROOT )
49- rows .append ((str (rel ), translated_pct , fuzzy_pct ))
50+ rows .append ((str (rel ), translated_pct , fuzzy_pct , t , u , total ))
51+
52+ totals ["translated" ] += t
53+ totals ["fuzzy" ] += fz
54+ totals ["untranslated" ] += u
5055
5156 # most-complete files first, matching the old report's ordering
5257 rows .sort (key = lambda r : (- r [1 ], r [0 ]))
5358
5459 lines = [
55- "| File | Translated | Fuzzy |" ,
56- "|:-----|:-----------:|:-----------:|" ,
60+ "| فایل | ترجمهشده | مبهم | تعداد ترجمهشده | تعداد ترجمهنشده |" ,
61+ "|:-----|:-----------:|:-----------:|:-----------:|:-----------:| " ,
5762 ]
58- for name , t_pct , f_pct in rows :
59- lines .append (f"| { name } | { t_pct :.1f} % | { f_pct :.1f} % |" )
63+ for name , t_pct , f_pct , t_count , u_count , _total in rows :
64+ lines .append (
65+ f"| { name } | { t_pct :.1f} % | { f_pct :.1f} % | { t_count } | { u_count } |"
66+ )
67+
68+ grand_total = sum (totals .values ())
69+ lines .append (
70+ f"| **مجموع** | "
71+ f"**{ (totals ['translated' ] / grand_total * 100 ) if grand_total else 100.0 :.1f} %** | "
72+ f"**{ (totals ['fuzzy' ] / grand_total * 100 ) if grand_total else 0.0 :.1f} %** | "
73+ f"**{ totals ['translated' ]} ** | **{ totals ['untranslated' ]} ** |"
74+ )
75+
6076 return "\n " .join (lines )
6177
6278
0 commit comments