Add plural keys for albums and tracks

This commit is contained in:
Alexey Remizov
2025-06-27 08:09:08 -07:00
committed by Drew Weymouth
parent bb8d677aab
commit 097310504c
6 changed files with 37 additions and 5 deletions
+5 -1
View File
@@ -3,6 +3,7 @@ package browsing
import (
"fmt"
"log"
"strconv"
"strings"
"github.com/dweymouth/supersonic/backend"
@@ -396,11 +397,14 @@ func formatMiscLabelStr(a *mediaprovider.AlbumWithTracks) string {
if a.TrackCount == 1 {
tracks = lang.L("track")
}
fallbackTracksMsg := fmt.Sprintf("%d %s", a.TrackCount, tracks)
tracksMsg := lang.LocalizePluralKey("{{.trackCount}} tracks",
fallbackTracksMsg, a.TrackCount, map[string]string{"trackCount": strconv.Itoa(a.TrackCount)})
yearStr := util.FormatItemDate(a.Date)
if y := a.ReissueDate.Year; y != nil && *y > a.YearOrZero() {
yearStr += fmt.Sprintf(" (%s %s)", lang.L("reissued"), util.FormatItemDate(a.ReissueDate))
}
return fmt.Sprintf("%s · %d %s · %s%s", yearStr, a.TrackCount, tracks, discs, util.SecondsToTimeString(float64(a.Duration)))
return fmt.Sprintf("%s · %s · %s%s", yearStr, tracksMsg, discs, util.SecondsToTimeString(float64(a.Duration)))
}
func (s *albumPageState) Restore() Page {