[+] More i18n

This commit is contained in:
Azalea
2024-03-06 10:13:08 -05:00
parent 3faa5b2f52
commit 16f6acf8fc
4 changed files with 28 additions and 14 deletions

View File

@@ -16,9 +16,9 @@ if (navigator.language.startsWith('zh')) {
lang = 'zh'
}
export function t(key: keyof LocalizedMessages, variables?: { [index: string]: string }) {
export function t(key: keyof LocalizedMessages, variables?: { [index: string]: any }) {
if (variables) {
return msgs[lang][key].replace(/\${(.*?)}/g, (_: string, v: string | number) => variables[v])
return msgs[lang][key].replace(/\${(.*?)}/g, (_: string, v: string | number) => variables[v] + "")
}
return msgs[lang][key]
}