From 9ee8e9d0d8ffe98b6905f6187dd212c31a823f92 Mon Sep 17 00:00:00 2001 From: cwilvx Date: Mon, 14 Oct 2024 17:29:35 +0300 Subject: [PATCH] localize track count --- app/api/scrobble/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/api/scrobble/__init__.py b/app/api/scrobble/__init__.py index 8928a873..4940033c 100644 --- a/app/api/scrobble/__init__.py +++ b/app/api/scrobble/__init__.py @@ -1,4 +1,5 @@ from dataclasses import dataclass +from gettext import ngettext from itertools import groupby from math import e from pprint import pprint @@ -313,7 +314,9 @@ def get_stats(): total_tracks = StatItem( "trackcount", "in your library", - f"{count} track{'' if count == 1 else 's'}", + locale.format_string("%d", count, grouping=True) + + " " + + ngettext("track", "tracks", count), ) tracks, playcount, playduration = get_tracks_in_period(start_time, end_time)