| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,6 +38,7 @@ def file_stats(path: Path): | |||
| 38 | 38 | def build_table() -> str: | |
| 39 | 39 | files = sorted(REPO_ROOT.rglob("*.po")) | |
| 40 | 40 | rows = [] | |
| 41 | + totals = {"translated": 0, "fuzzy": 0, "untranslated": 0} | ||
| 41 | 42 | for f in files: | |
| 42 | 43 | if ".cpython-src" in f.parts or ".git" in f.parts: | |
| 43 | 44 | continue | |
@@ -46,17 +47,32 @@ def build_table() -> str: | |||
| 46 | 47 | translated_pct = (t / total * 100) if total else 100.0 | |
| 47 | 48 | fuzzy_pct = (fz / total * 100) if total else 0.0 | |
| 48 | 49 | 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 | ||
| 50 | 55 | ||
| 51 | 56 | # most-complete files first, matching the old report's ordering | |
| 52 | 57 | rows.sort(key=lambda r: (-r[1], r[0])) | |
| 53 | 58 | ||
| 54 | 59 | lines = [ | |
| 55 | - "| File | Translated | Fuzzy |", | ||
| 56 | - "|:-----|:-----------:|:-----------:|", | ||
| 60 | + "| فایل | ترجمهشده | مبهم | تعداد ترجمهشده | تعداد ترجمهنشده |", | ||
| 61 | + "|:-----|:-----------:|:-----------:|:-----------:|:-----------:|", | ||
| 57 | 62 | ] | |
| 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 | + | ||
| 60 | 76 | return "\n".join(lines) | |
| 61 | 77 | ||
| 62 | 78 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments