mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: Replacing 'appName' translation token
(cherry picked from commit 2e51b8792db0d3ec402672dc92c95f3cb886ef44)
This commit is contained in:
@@ -25,11 +25,12 @@ export async function fetchTranslations(): Promise<boolean> {
|
|||||||
|
|
||||||
export default function translate(
|
export default function translate(
|
||||||
key: string,
|
key: string,
|
||||||
tokens?: Record<string, string | number | boolean>
|
tokens: Record<string, string | number | boolean> = {}
|
||||||
) {
|
) {
|
||||||
const translation = translations[key] || key;
|
const translation = translations[key] || key;
|
||||||
|
|
||||||
if (tokens) {
|
tokens.appName = 'Prowlarr';
|
||||||
|
|
||||||
// Fallback to the old behaviour for translations not yet updated to use named tokens
|
// Fallback to the old behaviour for translations not yet updated to use named tokens
|
||||||
Object.values(tokens).forEach((value, index) => {
|
Object.values(tokens).forEach((value, index) => {
|
||||||
tokens[index] = value;
|
tokens[index] = value;
|
||||||
@@ -39,6 +40,3 @@ export default function translate(
|
|||||||
String(tokens[tokenMatch] ?? match)
|
String(tokens[tokenMatch] ?? match)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return translation;
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user