mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-15 01:23:53 -07:00
Fixed: Replacing 'appName' translation token
(cherry picked from commit 2e51b8792db0d3ec402672dc92c95f3cb886ef44) Closes #4284
This commit is contained in:
parent
7d38336bb5
commit
a53cefec51
1 changed files with 9 additions and 11 deletions
|
@ -25,11 +25,12 @@ export async function fetchTranslations(): Promise<boolean> {
|
|||
|
||||
export default function translate(
|
||||
key: string,
|
||||
tokens: Record<string, string | number | boolean> = { appName: 'Lidarr' }
|
||||
tokens: Record<string, string | number | boolean> = {}
|
||||
) {
|
||||
const translation = translations[key] || key;
|
||||
|
||||
if (tokens) {
|
||||
tokens.appName = 'Lidarr';
|
||||
|
||||
// Fallback to the old behaviour for translations not yet updated to use named tokens
|
||||
Object.values(tokens).forEach((value, index) => {
|
||||
tokens[index] = value;
|
||||
|
@ -39,6 +40,3 @@ export default function translate(
|
|||
String(tokens[tokenMatch] ?? match)
|
||||
);
|
||||
}
|
||||
|
||||
return translation;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue