1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-18 21:35:27 -04:00

Fixed: Replacing 'appName' translation token

This commit is contained in:
Stevie Robinson
2023-11-10 01:00:54 +01:00
committed by GitHub
parent 8c3a0ebaba
commit 2e51b8792d
+5 -7
View File
@@ -25,15 +25,13 @@ export async function fetchTranslations(): Promise<boolean> {
export default function translate(
key: string,
tokens: Record<string, string | number | boolean> = { appName: 'Sonarr' }
tokens: Record<string, string | number | boolean> = {}
) {
const translation = translations[key] || key;
if (tokens) {
return translation.replace(/\{([a-z0-9]+?)\}/gi, (match, tokenMatch) =>
String(tokens[tokenMatch] ?? match)
);
}
tokens.appName = 'Sonarr';
return translation;
return translation.replace(/\{([a-z0-9]+?)\}/gi, (match, tokenMatch) =>
String(tokens[tokenMatch] ?? match)
);
}