From 2e51b8792db0d3ec402672dc92c95f3cb886ef44 Mon Sep 17 00:00:00 2001 From: Stevie Robinson Date: Fri, 10 Nov 2023 01:00:54 +0100 Subject: [PATCH] Fixed: Replacing 'appName' translation token --- frontend/src/Utilities/String/translate.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/frontend/src/Utilities/String/translate.ts b/frontend/src/Utilities/String/translate.ts index 7d59a22d1..76ab770ea 100644 --- a/frontend/src/Utilities/String/translate.ts +++ b/frontend/src/Utilities/String/translate.ts @@ -25,15 +25,13 @@ export async function fetchTranslations(): Promise { export default function translate( key: string, - tokens: Record = { appName: 'Sonarr' } + tokens: Record = {} ) { 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) + ); }