From 106707b40fbcb168f3bad05155227fec24b59c48 Mon Sep 17 00:00:00 2001 From: Antonin Delpeuch Date: Mon, 28 Jul 2025 15:16:27 +0200 Subject: [PATCH] feat(ui): pretty-print commit counts and other numbers (#8704) Currently on https://codeberg.org/forgejo/forgejo for instance, the commit count is shown as "23378 commits", instead of "23,378 commits". This makes sure such numbers are printed with thousands separators if they are big enough. Preview: - https://codeberg.org/attachments/681add48-337b-42c0-a0ae-ac5ad4671b39 - https://codeberg.org/attachments/8b5d4e40-bdd6-4942-905f-6ddeac8509a9 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8704 Reviewed-by: Gusted Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: Antonin Delpeuch Co-committed-by: Antonin Delpeuch --- templates/repo/commits_table.tmpl | 2 +- templates/repo/sub_menu.tmpl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl index 621fc44bf5..c0e4f5ca46 100644 --- a/templates/repo/commits_table.tmpl +++ b/templates/repo/commits_table.tmpl @@ -1,7 +1,7 @@

{{if or .PageIsCommits (gt .CommitCount 0)}} - {{ctx.Locale.TrN .CommitCount "repo.n_commit_one" "repo.n_commit_few" (StringUtils.ToString .CommitCount)}} + {{ctx.Locale.TrN .CommitCount "repo.n_commit_one" "repo.n_commit_few" (ctx.Locale.PrettyNumber .CommitCount)}} {{else if .IsNothingToCompare}} {{ctx.Locale.Tr "repo.commits.nothing_to_compare"}} {{else}} diff --git a/templates/repo/sub_menu.tmpl b/templates/repo/sub_menu.tmpl index ee1b959a7c..6216ad6191 100644 --- a/templates/repo/sub_menu.tmpl +++ b/templates/repo/sub_menu.tmpl @@ -3,14 +3,14 @@