Files
minstrel/internal/words/words.go
T
bvandeusenandClaude Opus 5.5 db15713798
release / govulncheck (push) Successful in 22s
release / web (push) Successful in 1m35s
release / go (push) Successful in 1m45s
release / integration (push) Successful in 5m41s
release / android (push) Successful in 6m7s
release / Build signed APK (releases and dev) (push) Successful in 6m26s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 29s
release / Verify release artifacts (tag releases only) (push) Skipped
refactor: the server says a count one way, words.Count, for notifications, a wanted match's reason and the duplicate resolver's activity line (M505 #5643)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:18:50 -04:00

16 lines
557 B
Go

// Package words says counts in English for what the server writes to people:
// notifications, emails, the reasons a scan or a match gives.
package words
import "strconv"
// Count says n with the noun that agrees with it: "1 track", "3 tracks". The
// noun may carry its verb ("track went missing" / "tracks went missing").
// The web app's plural() is the same thing on the other side (M505).
func Count[N ~int | ~int32 | ~int64](n N, one, many string) string {
if n == 1 {
return "1 " + one
}
return strconv.FormatInt(int64(n), 10) + " " + many
}