aboutsummaryrefslogtreecommitdiff
path: root/test-client
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-09-20 12:14:24 +0200
committermetamuffin <metamuffin@disroot.org>2024-09-20 12:14:24 +0200
commit84ffee97ace4e7d3f8e58da99b9e0568bd4c9bed (patch)
treec101fcd23daa1b61c1951ae8ae121a599f51df38 /test-client
parent9853cd599f6e84333d8688edc324861b67c86bbb (diff)
downloadhurrycurry-84ffee97ace4e7d3f8e58da99b9e0568bd4c9bed.tar
hurrycurry-84ffee97ace4e7d3f8e58da99b9e0568bd4c9bed.tar.bz2
hurrycurry-84ffee97ace4e7d3f8e58da99b9e0568bd4c9bed.tar.zst
tc: update tr for new format templates
Diffstat (limited to 'test-client')
-rw-r--r--test-client/locale.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/test-client/locale.ts b/test-client/locale.ts
index 59f77eac..c49e7d12 100644
--- a/test-client/locale.ts
+++ b/test-client/locale.ts
@@ -15,9 +15,9 @@ export async function init_locale(lang?: string) {
}
export function tr(key: string, ...args: string[]): string {
- let s = TR[key] ?? key;
- if (args.length)
- s = s.replace(/%(s|i)/ig, () => args.shift() ?? "[not provided]")
+ let s = TR[key];
+ if (!s) return key
+ if (args.length) s = s.replace(/{(\d+)}/ig, (_m, index) => args[parseInt(index)])
return s
}