From 617b9c5d35e73561f3ca8f28cff0541528531e91 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Mon, 4 Nov 2024 15:24:45 +0200 Subject: [PATCH] Console warnings for missing translations on development builds (cherry picked from commit 67a1ecb0fea4e6c7dfdb68fbe3ef30d4c22398d8) Closes #10669 --- frontend/src/Utilities/String/translate.ts | 6 ++++++ frontend/typings/Globals.d.ts | 1 + 2 files changed, 7 insertions(+) diff --git a/frontend/src/Utilities/String/translate.ts b/frontend/src/Utilities/String/translate.ts index 8081995ab..f4cab8ec6 100644 --- a/frontend/src/Utilities/String/translate.ts +++ b/frontend/src/Utilities/String/translate.ts @@ -27,6 +27,12 @@ export default function translate( key: string, tokens: Record = {} ) { + const { isProduction = true } = window.Radarr; + + if (!isProduction && !(key in translations)) { + console.warn(`Missing translation for key: ${key}`); + } + const translation = translations[key] || key; tokens.appName = 'Radarr'; diff --git a/frontend/typings/Globals.d.ts b/frontend/typings/Globals.d.ts index 29136ac48..21e40447b 100644 --- a/frontend/typings/Globals.d.ts +++ b/frontend/typings/Globals.d.ts @@ -7,5 +7,6 @@ interface Window { theme: string; urlBase: string; version: string; + isProduction: boolean; }; }