Skip to content

Commit 261d7ec

Browse files
committed
feat: add translations count to homepage
1 parent 3ed2372 commit 261d7ec

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

docs/templates/home_page.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ <h2 class="background">Some Stats</h2>
3434
<p>{{ _(trans["translators"]) }}</p>
3535
<p><strong>{{ team_nb }}</strong></p>
3636
</div>
37+
<div>
38+
<p>Translations</p>
39+
<p><strong>{{ translation_count }}</strong></p>
40+
</div>
3741
</div>
3842
</div>
3943

scripts/update_index.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ def build_html_page(**kwargs) -> str:
8080
create_page_language(page_html, language)
8181

8282
# on crée la page par defaut (home)
83+
tp2_nb = 0
84+
translation_count = 0
8385
with LANGUAGE_CONFIG.switch_language("en"):
84-
tp2_nb = 0
8586
mods = ModManager.get_mod_list("en")
8687
mod_id_to_name = {mod.id: mod.name for mod in mods}
8788

@@ -91,6 +92,8 @@ def build_html_page(**kwargs) -> str:
9192
team |= set(mod.team)
9293
if mod.tp2 not in ("n/a", "non-weidu", ""):
9394
tp2_nb += 1
95+
if mod.translation_state != "n/a":
96+
translation_count += int(len(mod.languages) - 1)
9497

9598
last_added_mods = ModManager.get_last_added_mods(mods, nb=20)
9699
last_updated_mods = ModManager.get_last_updated_mods(mods, nb=20)
@@ -106,6 +109,7 @@ def build_html_page(**kwargs) -> str:
106109
team_nb=len(team),
107110
mod_id_to_name=mod_id_to_name,
108111
tp2_nb=tp2_nb,
112+
translation_count=translation_count,
109113
categories={
110114
HomeCategory(id=1, value="Last Added Mods"): last_added_mods,
111115
HomeCategory(id=2, value="Last Updated Mods"): last_updated_mods,

0 commit comments

Comments
 (0)