mirror of
https://github.com/Readarr/Readarr
synced 2025-12-06 16:32:51 +01:00
Console warnings for missing translations on development builds
(cherry picked from commit 67a1ecb0fea4e6c7dfdb68fbe3ef30d4c22398d8) Closes #3863
This commit is contained in:
parent
dba9fbf254
commit
a362dab503
2 changed files with 7 additions and 0 deletions
|
|
@ -27,6 +27,12 @@ export default function translate(
|
||||||
key: string,
|
key: string,
|
||||||
tokens: Record<string, string | number | boolean> = {}
|
tokens: Record<string, string | number | boolean> = {}
|
||||||
) {
|
) {
|
||||||
|
const { isProduction = true } = window.Readarr;
|
||||||
|
|
||||||
|
if (!isProduction && !(key in translations)) {
|
||||||
|
console.warn(`Missing translation for key: ${key}`);
|
||||||
|
}
|
||||||
|
|
||||||
const translation = translations[key] || key;
|
const translation = translations[key] || key;
|
||||||
|
|
||||||
tokens.appName = 'Readarr';
|
tokens.appName = 'Readarr';
|
||||||
|
|
|
||||||
1
frontend/typings/Globals.d.ts
vendored
1
frontend/typings/Globals.d.ts
vendored
|
|
@ -7,5 +7,6 @@ interface Window {
|
||||||
theme: string;
|
theme: string;
|
||||||
urlBase: string;
|
urlBase: string;
|
||||||
version: string;
|
version: string;
|
||||||
|
isProduction: boolean;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue