From 25ecb1cb75b7b5b584ad223e12d74c3e3ee7da89 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 12 Feb 2023 13:05:25 +0100 Subject: Add textual search on title, subtitle and authors --- src/lib/i18n.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/lib/i18n.ts (limited to 'src/lib/i18n.ts') diff --git a/src/lib/i18n.ts b/src/lib/i18n.ts new file mode 100644 index 0000000..cd5b3de --- /dev/null +++ b/src/lib/i18n.ts @@ -0,0 +1,9 @@ +export function unit(n: number, singular: string, plural: string, f: (n: number, unit: string) => string = format): string { + return n > 1 + ? f(n, plural) + : f(n, singular) +} + +function format(n: number, unit: string): string { + return `${n} ${unit}` +} -- cgit v1.2.3