8 lines
449 B
TypeScript
8 lines
449 B
TypeScript
// A count with its noun: "1 track", "26,171 tracks". The noun may carry the
|
|
// words that agree with it ("album has" / "albums have"). The number is in the
|
|
// viewer's locale, as the app's other counts are. The web app's one way to say
|
|
// a count (M505); a source guard in plural.test.ts names any hand-written copy.
|
|
export function plural(n: number, one: string, many: string): string {
|
|
return `${n.toLocaleString()} ${n === 1 ? one : many}`;
|
|
}
|