From ec93c33aa9f4925c6d463f6c1c8d603da6c56a70 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 #5239 --- frontend/src/Utilities/String/translate.ts | 6 ++++++ frontend/typings/Globals.d.ts | 1 + src/NzbDrone.Core/Localization/Core/en.json | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/frontend/src/Utilities/String/translate.ts b/frontend/src/Utilities/String/translate.ts index a4546a218..5571ef6b0 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.Lidarr; + + if (!isProduction && !(key in translations)) { + console.warn(`Missing translation for key: ${key}`); + } + const translation = translations[key] || key; tokens.appName = 'Lidarr'; diff --git a/frontend/typings/Globals.d.ts b/frontend/typings/Globals.d.ts index b2b10fb70..3509249fc 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; }; } diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index 24a02144c..91ef5f5aa 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -707,6 +707,7 @@ "MassSearchCancelWarning": "This cannot be cancelled once started without restarting {appName} or disabling all of your indexers.", "MatchedToAlbums": "Matched to Albums", "MatchedToArtist": "Matched to Artist", + "Max": "Max", "MaximumLimits": "Maximum Limits", "MaximumSize": "Maximum Size", "MaximumSizeHelpText": "Maximum size for a release to be grabbed in MB. Set to zero to set to unlimited.", @@ -727,6 +728,7 @@ "MetadataProfiles": "Metadata Profiles", "MetadataSettings": "Metadata Settings", "MetadataSettingsArtistSummary": "Create metadata files when tracks are imported or artist are refreshed", + "Min": "Min", "MinFormatScoreHelpText": "Minimum custom format score allowed to download", "MinimumAge": "Minimum Age", "MinimumAgeHelpText": "Usenet only: Minimum age in minutes of NZBs before they are grabbed. Use this to give new releases time to propagate to your usenet provider.", @@ -894,6 +896,7 @@ "PreferProtocol": "Prefer {preferredProtocol}", "PreferTorrent": "Prefer Torrent", "PreferUsenet": "Prefer Usenet", + "Preferred": "Preferred", "PreferredProtocol": "Preferred Protocol", "PreferredSize": "Preferred Size", "Presets": "Presets", @@ -1208,6 +1211,7 @@ "TimeFormat": "Time Format", "TimeLeft": "Time Left", "Title": "Title", + "Today": "Today", "Tomorrow": "Tomorrow", "TorrentDelay": "Torrent Delay", "TorrentDelayHelpText": "Delay in minutes to wait before grabbing a torrent",