Fix i18n placeholder replacement to handle repeated occurrences

Use replaceAll instead of replace to substitute all instances of
a placeholder in translation strings, not just the first one.
This commit is contained in:
Pier-Jean Malandrino 2026-04-03 13:05:44 +02:00
parent afc9b2e9f2
commit 6a791cec48

View file

@ -233,7 +233,7 @@ export function useI18n() {
function t(key: string, params: Record<string, string | number> = {}): string {
let str = messages[settings.locale]?.[key] || messages['fr'][key] || key
for (const [k, v] of Object.entries(params)) {
str = str.replace(`{${k}}`, String(v))
str = str.replaceAll(`{${k}}`, String(v))
}
return str
}