From ecbdd58f42395f2e2788da60849a6642a23a02c6 Mon Sep 17 00:00:00 2001 From: Qstick Date: Tue, 8 Sep 2020 21:38:05 -0400 Subject: [PATCH] New: Separate UI Language into two settings for Movie Info and Main UI --- .../src/Components/Page/Sidebar/PageSidebar.js | 2 +- frontend/src/Settings/UI/UISettings.js | 17 +++++++++++++++-- .../Configuration/ConfigService.cs | 7 +++++++ .../Configuration/IConfigService.cs | 1 + src/NzbDrone.Core/Localization/Core/en.json | 11 +++++++---- .../Localization/LocalizationService.cs | 6 +++--- src/Radarr.Api.V3/Config/UiConfigResource.cs | 4 +++- 7 files changed, 37 insertions(+), 11 deletions(-) diff --git a/frontend/src/Components/Page/Sidebar/PageSidebar.js b/frontend/src/Components/Page/Sidebar/PageSidebar.js index 2c3f64750..0006fa0db 100644 --- a/frontend/src/Components/Page/Sidebar/PageSidebar.js +++ b/frontend/src/Components/Page/Sidebar/PageSidebar.js @@ -117,7 +117,7 @@ const links = [ to: '/settings/general' }, { - title: translate('Ui'), + title: translate('UI'), to: '/settings/ui' } ] diff --git a/frontend/src/Settings/UI/UISettings.js b/frontend/src/Settings/UI/UISettings.js index 2200f0aba..465028423 100644 --- a/frontend/src/Settings/UI/UISettings.js +++ b/frontend/src/Settings/UI/UISettings.js @@ -196,17 +196,30 @@ class UISettings extends Component {
- {translate('SettingsUiLanguage')} + {translate('MovieInfoLanguage')} + + + {translate('UILanguage')} + +
} diff --git a/src/NzbDrone.Core/Configuration/ConfigService.cs b/src/NzbDrone.Core/Configuration/ConfigService.cs index 024acf5ff..364925be2 100644 --- a/src/NzbDrone.Core/Configuration/ConfigService.cs +++ b/src/NzbDrone.Core/Configuration/ConfigService.cs @@ -386,6 +386,13 @@ namespace NzbDrone.Core.Configuration set { SetValue("MovieInfoLanguage", value); } } + public int UILanguage + { + get { return GetValueInt("UILanguage", (int)Language.English); } + + set { SetValue("UILanguage", value); } + } + public bool CleanupMetadataImages { get { return GetValueBoolean("CleanupMetadataImages", true); } diff --git a/src/NzbDrone.Core/Configuration/IConfigService.cs b/src/NzbDrone.Core/Configuration/IConfigService.cs index 217f2452c..c95fde86d 100644 --- a/src/NzbDrone.Core/Configuration/IConfigService.cs +++ b/src/NzbDrone.Core/Configuration/IConfigService.cs @@ -77,6 +77,7 @@ namespace NzbDrone.Core.Configuration bool ShowRelativeDates { get; set; } bool EnableColorImpairedMode { get; set; } int MovieInfoLanguage { get; set; } + int UILanguage { get; set; } //Internal bool CleanupMetadataImages { get; set; } diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index e16a9c865..dbe579e6e 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -116,12 +116,12 @@ "Crew": "Crew", "CustomFilters": "Custom Filters", "CustomFormatJSON": "Custom Format JSON", - "CustomFormatUnknownCondition": "Unknown Custom Format condition '{0}'", - "CustomFormatUnknownConditionOption": "Unknown option '{0}' for condition '{1}'", "CustomFormats": "Custom Formats", "CustomFormatScore": "Custom Format score", "CustomFormatsSettings": "Custom Formats Settings", "CustomFormatsSettingsSummary": "Custom Formats and Settings", + "CustomFormatUnknownCondition": "Unknown Custom Format condition '{0}'", + "CustomFormatUnknownConditionOption": "Unknown option '{0}' for condition '{1}'", "Cutoff": "Cutoff", "CutoffFormatScoreHelpText": "Once this custom format score is reached Radarr will no longer download movies", "CutoffHelpText": "Once this quality is reached Radarr will no longer download movies", @@ -413,6 +413,8 @@ "MovieFolderFormat": "Movie Folder Format", "MovieID": "Movie ID", "MovieIndex": "Movie Index", + "MovieInfoLanguage": "Movie Info Language", + "MovieInfoLanguageHelpText": "Language that Radarr will use for Movie Information in UI", "MovieInfoLanguageHelpTextWarning": "Browser Reload Required", "MovieIsDownloading": "Movie is downloading", "MovieIsDownloadingInterp": "Movie is downloading - {0}% {1}", @@ -635,8 +637,6 @@ "SettingsShowRelativeDates": "Show Relative Dates", "SettingsShowRelativeDatesHelpText": "Show relative (Today/Yesterday/etc) or absolute dates", "SettingsTimeFormat": "Time Format", - "SettingsUiLanguage": "UI Language", - "SettingsUiLanguageHelpText": "Language that Radarr will use for UI", "SettingsWeekColumnHeader": "Week Column Header", "SettingsWeekColumnHeaderHelpText": "Shown above each column when week is the active view", "ShouldMonitorHelpText": "If enabled, movies added by this list are added and monitored", @@ -718,6 +718,9 @@ "TotalSpace": "Total Space", "Type": "Type", "UI": "UI", + "UILanguage": "UI Language", + "UILanguageHelpText": "Language that Radarr will use for UI", + "UILanguageHelpTextWarning": "Browser Reload Required", "UISettings": "UI Settings", "UISettingsSummary": "Calendar, date and color impaired options", "UnableToAddANewConditionPleaseTryAgain": "Unable to add a new condition, please try again.", diff --git a/src/NzbDrone.Core/Localization/LocalizationService.cs b/src/NzbDrone.Core/Localization/LocalizationService.cs index ee6ea20f6..beba6aff9 100644 --- a/src/NzbDrone.Core/Localization/LocalizationService.cs +++ b/src/NzbDrone.Core/Localization/LocalizationService.cs @@ -45,14 +45,14 @@ namespace NzbDrone.Core.Localization public Dictionary GetLocalizationDictionary() { - var language = IsoLanguages.Get((Language)_configService.MovieInfoLanguage).TwoLetterCode; + var language = IsoLanguages.Get((Language)_configService.UILanguage).TwoLetterCode; return GetLocalizationDictionary(language); } public string GetLocalizedString(string phrase) { - var language = IsoLanguages.Get((Language)_configService.MovieInfoLanguage).TwoLetterCode; + var language = IsoLanguages.Get((Language)_configService.UILanguage).TwoLetterCode; return GetLocalizedString(phrase, language); } @@ -66,7 +66,7 @@ namespace NzbDrone.Core.Localization if (language.IsNullOrWhiteSpace()) { - language = IsoLanguages.Get((Language)_configService.MovieInfoLanguage).TwoLetterCode; + language = IsoLanguages.Get((Language)_configService.UILanguage).TwoLetterCode; } if (language == null) diff --git a/src/Radarr.Api.V3/Config/UiConfigResource.cs b/src/Radarr.Api.V3/Config/UiConfigResource.cs index e84d20843..bb1fef871 100644 --- a/src/Radarr.Api.V3/Config/UiConfigResource.cs +++ b/src/Radarr.Api.V3/Config/UiConfigResource.cs @@ -20,6 +20,7 @@ namespace Radarr.Api.V3.Config public bool EnableColorImpairedMode { get; set; } public int MovieInfoLanguage { get; set; } + public int UILanguage { get; set; } } public static class UiConfigResourceMapper @@ -39,7 +40,8 @@ namespace Radarr.Api.V3.Config ShowRelativeDates = model.ShowRelativeDates, EnableColorImpairedMode = model.EnableColorImpairedMode, - MovieInfoLanguage = model.MovieInfoLanguage + MovieInfoLanguage = model.MovieInfoLanguage, + UILanguage = model.UILanguage }; } }