From bfc036178487fe0b692f306a53f2a334cdf7f9d5 Mon Sep 17 00:00:00 2001 From: Qstick Date: Wed, 8 Jul 2020 10:40:08 -0400 Subject: [PATCH] New: Translations support for Health Checks --- .../HealthCheck/Checks/AppDataLocationFixture.cs | 12 +++++++++++- .../HealthCheck/Checks/DotnetVersionCheckFixture.cs | 10 ++++++++++ .../HealthCheck/Checks/DownloadClientCheckFixture.cs | 12 +++++++++++- .../Checks/ImportMechanismCheckFixture.cs | 10 ++++++++++ .../HealthCheck/Checks/IndexerRssCheckFixture.cs | 11 ++++++++++- .../HealthCheck/Checks/IndexerSearchCheckFixture.cs | 11 ++++++++++- .../HealthCheck/Checks/IndexerStatusCheckFixture.cs | 5 +++++ .../HealthCheck/Checks/MonoVersionCheckFixture.cs | 10 ++++++++++ .../Checks/NetImportStatusCheckFixture.cs | 5 +++++ .../HealthCheck/Checks/ReleaseBranchCheckFixture.cs | 10 ++++++++++ .../HealthCheck/Checks/RemovedMovieCheckFixture.cs | 12 +++++++++++- .../HealthCheck/Checks/RootFolderCheckFixture.cs | 9 +++++++++ .../HealthCheck/Checks/UpdateCheckFixture.cs | 11 ++++++++++- .../HealthCheck/Checks/AppDataLocationCheck.cs | 8 +++++--- .../HealthCheck/Checks/DotnetVersionCheck.cs | 10 ++++++---- .../HealthCheck/Checks/DownloadClientCheck.cs | 8 +++++--- .../HealthCheck/Checks/DownloadClientStatusCheck.cs | 10 ++++++---- .../HealthCheck/Checks/ImportMechanismCheck.cs | 6 ++++-- .../HealthCheck/Checks/IndexerRssCheck.cs | 10 ++++++---- .../HealthCheck/Checks/IndexerSearchCheck.cs | 12 +++++++----- .../HealthCheck/Checks/IndexerStatusCheck.cs | 8 +++++--- .../HealthCheck/Checks/MediaInfoDllCheck.cs | 10 ++++++++-- .../HealthCheck/Checks/MonoDebugCheck.cs | 6 ++++-- .../HealthCheck/Checks/MonoNotNetCoreCheck.cs | 7 +++++-- src/NzbDrone.Core/HealthCheck/Checks/MonoTlsCheck.cs | 8 +++++--- .../HealthCheck/Checks/MonoVersionCheck.cs | 4 +++- src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs | 6 ++++-- .../HealthCheck/Checks/NetImportStatusCheck.cs | 8 +++++--- .../HealthCheck/Checks/PTPOldSettingsCheck.cs | 6 ++++-- src/NzbDrone.Core/HealthCheck/Checks/ProxyCheck.cs | 12 +++++++----- .../HealthCheck/Checks/ReleaseBranchCheck.cs | 8 +++++--- .../HealthCheck/Checks/RemotePathMappingCheck.cs | 5 ++++- .../HealthCheck/Checks/RemovedMovieCheck.cs | 10 ++++++---- .../HealthCheck/Checks/RootFolderCheck.cs | 8 +++++--- src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs | 11 +++++++---- src/NzbDrone.Core/HealthCheck/HealthCheckBase.cs | 10 +++++++++- 36 files changed, 247 insertions(+), 72 deletions(-) diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/AppDataLocationFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/AppDataLocationFixture.cs index ade6278e3..0f63c09fa 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/AppDataLocationFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/AppDataLocationFixture.cs @@ -1,6 +1,8 @@ -using NUnit.Framework; +using Moq; +using NUnit.Framework; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Core.HealthCheck.Checks; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; @@ -9,6 +11,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [TestFixture] public class AppDataLocationFixture : CoreTest { + [SetUp] + public void Setup() + { + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); + } + [Test] public void should_return_warning_when_app_data_is_child_of_startup_folder() { diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/DotnetVersionCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/DotnetVersionCheckFixture.cs index 4e130ada0..d6caec81a 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/DotnetVersionCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/DotnetVersionCheckFixture.cs @@ -1,7 +1,9 @@ using System; +using Moq; using NUnit.Framework; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Core.HealthCheck.Checks; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks @@ -9,6 +11,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [TestFixture] public class DotnetVersionCheckFixture : CoreTest { + [SetUp] + public void Setup() + { + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); + } + private void GivenOutput(string version) { WindowsOnly(); diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs index d2097304e..c50f9416b 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs @@ -1,8 +1,10 @@ -using System; +using System; using System.Collections.Generic; +using Moq; using NUnit.Framework; using NzbDrone.Core.Download; using NzbDrone.Core.HealthCheck.Checks; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks @@ -10,6 +12,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [TestFixture] public class DownloadClientCheckFixture : CoreTest { + [SetUp] + public void Setup() + { + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); + } + [Test] public void should_return_warning_when_download_client_has_not_been_configured() { diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportMechanismCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportMechanismCheckFixture.cs index 78e725d82..e2276f51a 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportMechanismCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportMechanismCheckFixture.cs @@ -1,6 +1,8 @@ +using Moq; using NUnit.Framework; using NzbDrone.Core.Configuration; using NzbDrone.Core.HealthCheck.Checks; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks @@ -8,6 +10,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [TestFixture] public class ImportMechanismCheckFixture : CoreTest { + [SetUp] + public void Setup() + { + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); + } + private void GivenCompletedDownloadHandling(bool? enabled = null) { if (enabled.HasValue) diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerRssCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerRssCheckFixture.cs index 28d314005..e2bcec417 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerRssCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerRssCheckFixture.cs @@ -1,8 +1,9 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Moq; using NUnit.Framework; using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.Indexers; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks @@ -22,6 +23,10 @@ public void SetUp() Mocker.GetMock() .Setup(s => s.RssEnabled(It.IsAny())) .Returns(new List()); + + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); } private void GivenIndexer(bool supportsRss, bool supportsSearch) @@ -47,6 +52,10 @@ private void GivenRssFiltered() Mocker.GetMock() .Setup(s => s.RssEnabled(false)) .Returns(new List { _indexerMock.Object }); + + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("recent indexer errors"); } [Test] diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerSearchCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerSearchCheckFixture.cs index cffb07207..e0bf60922 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerSearchCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerSearchCheckFixture.cs @@ -1,8 +1,9 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Moq; using NUnit.Framework; using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.Indexers; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks @@ -26,6 +27,10 @@ public void SetUp() Mocker.GetMock() .Setup(s => s.InteractiveSearchEnabled(It.IsAny())) .Returns(new List()); + + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); } private void GivenIndexer(bool supportsRss, bool supportsSearch) @@ -62,6 +67,10 @@ private void GivenSearchFiltered() Mocker.GetMock() .Setup(s => s.InteractiveSearchEnabled(false)) .Returns(new List { _indexerMock.Object }); + + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("recent indexer errors"); } [Test] diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerStatusCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerStatusCheckFixture.cs index a77eecf13..acf4f054c 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerStatusCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/IndexerStatusCheckFixture.cs @@ -4,6 +4,7 @@ using NUnit.Framework; using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.Indexers; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks @@ -24,6 +25,10 @@ public void SetUp() Mocker.GetMock() .Setup(v => v.GetBlockedProviders()) .Returns(_blockedIndexers); + + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); } private Mock GivenIndexer(int i, double backoffHours, double failureHours) diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoVersionCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoVersionCheckFixture.cs index e33402e41..999ca159c 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoVersionCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoVersionCheckFixture.cs @@ -1,7 +1,9 @@ using System; +using Moq; using NUnit.Framework; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Core.HealthCheck.Checks; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks @@ -9,6 +11,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [TestFixture] public class MonoVersionCheckFixture : CoreTest { + [SetUp] + public void Setup() + { + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); + } + private void GivenOutput(string version) { MonoOnly(); diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/NetImportStatusCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/NetImportStatusCheckFixture.cs index 6c932a2e0..fdeff3ab7 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/NetImportStatusCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/NetImportStatusCheckFixture.cs @@ -3,6 +3,7 @@ using Moq; using NUnit.Framework; using NzbDrone.Core.HealthCheck.Checks; +using NzbDrone.Core.Localization; using NzbDrone.Core.NetImport; using NzbDrone.Core.Test.Framework; @@ -24,6 +25,10 @@ public void SetUp() Mocker.GetMock() .Setup(v => v.GetBlockedProviders()) .Returns(_blockedLists); + + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); } private Mock GivenList(int i, double backoffHours, double failureHours) diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/ReleaseBranchCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/ReleaseBranchCheckFixture.cs index abeed1742..0cbb0a832 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/ReleaseBranchCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/ReleaseBranchCheckFixture.cs @@ -1,6 +1,8 @@ +using Moq; using NUnit.Framework; using NzbDrone.Core.Configuration; using NzbDrone.Core.HealthCheck.Checks; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks @@ -8,6 +10,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [TestFixture] public class ReleaseBranchCheckFixture : CoreTest { + [SetUp] + public void Setup() + { + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); + } + private void GivenValidBranch(string branch) { Mocker.GetMock() diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/RemovedMovieCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/RemovedMovieCheckFixture.cs index 887f3d99b..04b623a36 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/RemovedMovieCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/RemovedMovieCheckFixture.cs @@ -1,15 +1,25 @@ using System.Collections.Generic; using FizzWare.NBuilder; +using Moq; using NUnit.Framework; using NzbDrone.Core.HealthCheck.Checks; +using NzbDrone.Core.Localization; using NzbDrone.Core.Movies; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HealthCheck.Checks { [TestFixture] - public class RemovedSeriesCheckFixture : CoreTest + public class RemovedMovieCheckFixture : CoreTest { + [SetUp] + public void Setup() + { + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); + } + private void GivenMovie(int amount, int deleted) { List movie; diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/RootFolderCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/RootFolderCheckFixture.cs index d7884d396..dd14540d8 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/RootFolderCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/RootFolderCheckFixture.cs @@ -5,6 +5,7 @@ using NUnit.Framework; using NzbDrone.Common.Disk; using NzbDrone.Core.HealthCheck.Checks; +using NzbDrone.Core.Localization; using NzbDrone.Core.Movies; using NzbDrone.Core.Test.Framework; @@ -13,6 +14,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [TestFixture] public class RootFolderCheckFixture : CoreTest { + [SetUp] + public void Setup() + { + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); + } + private void GivenMissingRootFolder() { var movies = Builder.CreateListOfSize(1) diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/UpdateCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/UpdateCheckFixture.cs index 751ba2e7f..64eeb9169 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/UpdateCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/UpdateCheckFixture.cs @@ -1,9 +1,10 @@ -using Moq; +using Moq; using NUnit.Framework; using NzbDrone.Common.Disk; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Core.Configuration; using NzbDrone.Core.HealthCheck.Checks; +using NzbDrone.Core.Localization; using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Update; @@ -12,6 +13,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [TestFixture] public class UpdateCheckFixture : CoreTest { + [SetUp] + public void Setup() + { + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); + } + [Test] public void should_return_error_when_app_folder_is_write_protected() { diff --git a/src/NzbDrone.Core/HealthCheck/Checks/AppDataLocationCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/AppDataLocationCheck.cs index 5969eb9be..a322ea085 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/AppDataLocationCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/AppDataLocationCheck.cs @@ -1,5 +1,6 @@ -using NzbDrone.Common.EnvironmentInfo; +using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Extensions; +using NzbDrone.Core.Localization; namespace NzbDrone.Core.HealthCheck.Checks { @@ -7,7 +8,8 @@ public class AppDataLocationCheck : HealthCheckBase { private readonly IAppFolderInfo _appFolderInfo; - public AppDataLocationCheck(IAppFolderInfo appFolderInfo) + public AppDataLocationCheck(IAppFolderInfo appFolderInfo, ILocalizationService localizationService) + : base(localizationService) { _appFolderInfo = appFolderInfo; } @@ -17,7 +19,7 @@ public override HealthCheck Check() if (_appFolderInfo.StartUpFolder.IsParentPath(_appFolderInfo.AppDataFolder) || _appFolderInfo.StartUpFolder.PathEquals(_appFolderInfo.AppDataFolder)) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Updating will not be possible to prevent deleting AppData on Update"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("AppDataLocationHealthCheckMessage")); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/DotnetVersionCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/DotnetVersionCheck.cs index 3c4279d4c..14564e250 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/DotnetVersionCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/DotnetVersionCheck.cs @@ -1,6 +1,7 @@ -using System; +using System; using NLog; using NzbDrone.Common.EnvironmentInfo; +using NzbDrone.Core.Localization; namespace NzbDrone.Core.HealthCheck.Checks { @@ -10,7 +11,8 @@ public class DotnetVersionCheck : HealthCheckBase private readonly IOsInfo _osInfo; private readonly Logger _logger; - public DotnetVersionCheck(IPlatformInfo platformInfo, IOsInfo osInfo, Logger logger) + public DotnetVersionCheck(IPlatformInfo platformInfo, IOsInfo osInfo, ILocalizationService localizationService, Logger logger) + : base(localizationService) { _platformInfo = platformInfo; _osInfo = osInfo; @@ -47,13 +49,13 @@ public override HealthCheck Check() _logger.Debug("Dotnet version is {0} or better: {1}", stableVersion, dotnetVersion); return new HealthCheck(GetType(), HealthCheckResult.Notice, - $"Currently installed .Net Framework {dotnetVersion} is supported but we recommend upgrading to at least {targetVersion}.", + string.Format(_localizationService.GetLocalizedString("DotNetVersionCheckNotRecommendedMessage"), dotnetVersion, targetVersion), "#currently-installed-net-framework-is-supported-but-upgrading-is-recommended"); } return new HealthCheck(GetType(), HealthCheckResult.Error, - $"Currently installed .Net Framework {dotnetVersion} is old and unsupported. Please upgrade the .Net Framework to at least {targetVersion}.", + string.Format(_localizationService.GetLocalizedString("DotNetVersionCheckOldUnsupportedMessage"), dotnetVersion, targetVersion), "#currently-installed-net-framework-is-old-and-unsupported"); } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientCheck.cs index dcdb0b8e3..3ab26420b 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientCheck.cs @@ -2,6 +2,7 @@ using System.Linq; using NLog; using NzbDrone.Core.Download; +using NzbDrone.Core.Localization; using NzbDrone.Core.ThingiProvider.Events; namespace NzbDrone.Core.HealthCheck.Checks @@ -15,7 +16,8 @@ public class DownloadClientCheck : HealthCheckBase private readonly IProvideDownloadClient _downloadClientProvider; private readonly Logger _logger; - public DownloadClientCheck(IProvideDownloadClient downloadClientProvider, Logger logger) + public DownloadClientCheck(IProvideDownloadClient downloadClientProvider, ILocalizationService localizationService, Logger logger) + : base(localizationService) { _downloadClientProvider = downloadClientProvider; _logger = logger; @@ -27,7 +29,7 @@ public override HealthCheck Check() if (!downloadClients.Any()) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "No download client is available"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("DownloadClientCheckNoneAvailableMessage")); } foreach (var downloadClient in downloadClients) @@ -40,7 +42,7 @@ public override HealthCheck Check() { _logger.Debug(ex, "Unable to communicate with {0}", downloadClient.Definition.Name); - var message = $"Unable to communicate with {downloadClient.Definition.Name}."; + var message = string.Format(_localizationService.GetLocalizedString("DownloadClientCheckUnableToCommunicateMessage"), downloadClient.Definition.Name); return new HealthCheck(GetType(), HealthCheckResult.Error, $"{message} {ex.Message}", "#unable-to-communicate-with-download-client"); } } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientStatusCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientStatusCheck.cs index 1cde736f2..9582ddcab 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientStatusCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientStatusCheck.cs @@ -1,6 +1,7 @@ -using System.Linq; +using System.Linq; using NzbDrone.Common.Extensions; using NzbDrone.Core.Download; +using NzbDrone.Core.Localization; using NzbDrone.Core.ThingiProvider.Events; namespace NzbDrone.Core.HealthCheck.Checks @@ -13,7 +14,8 @@ public class DownloadClientStatusCheck : HealthCheckBase private readonly IDownloadClientFactory _providerFactory; private readonly IDownloadClientStatusService _providerStatusService; - public DownloadClientStatusCheck(IDownloadClientFactory providerFactory, IDownloadClientStatusService providerStatusService) + public DownloadClientStatusCheck(IDownloadClientFactory providerFactory, IDownloadClientStatusService providerStatusService, ILocalizationService localizationService) + : base(localizationService) { _providerFactory = providerFactory; _providerStatusService = providerStatusService; @@ -35,10 +37,10 @@ public override HealthCheck Check() if (backOffProviders.Count == enabledProviders.Count) { - return new HealthCheck(GetType(), HealthCheckResult.Error, "All download clients are unavailable due to failures", "#download-clients-are-unavailable-due-to-failures"); + return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("DownloadClientStatusCheckAllClientMessage"), "#download-clients-are-unavailable-due-to-failures"); } - return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Download clients unavailable due to failures: {0}", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#download-clients-are-unavailable-due-to-failures"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("DownloadClientStatusCheckSingleClientMessage"), string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#download-clients-are-unavailable-due-to-failures"); } } } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs index b201cf7c4..61f35e7cf 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs @@ -1,6 +1,7 @@ using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration.Events; using NzbDrone.Core.Download; +using NzbDrone.Core.Localization; using NzbDrone.Core.ThingiProvider.Events; namespace NzbDrone.Core.HealthCheck.Checks @@ -12,7 +13,8 @@ public class ImportMechanismCheck : HealthCheckBase { private readonly IConfigService _configService; - public ImportMechanismCheck(IConfigService configService) + public ImportMechanismCheck(IConfigService configService, ILocalizationService localizationService) + : base(localizationService) { _configService = configService; } @@ -21,7 +23,7 @@ public override HealthCheck Check() { if (!_configService.EnableCompletedDownloadHandling) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("ImportMechanismHealthCheckMessage")); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/IndexerRssCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/IndexerRssCheck.cs index 03f60031b..db5b72c3b 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/IndexerRssCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/IndexerRssCheck.cs @@ -1,5 +1,6 @@ -using NzbDrone.Common.Extensions; +using NzbDrone.Common.Extensions; using NzbDrone.Core.Indexers; +using NzbDrone.Core.Localization; using NzbDrone.Core.ThingiProvider.Events; namespace NzbDrone.Core.HealthCheck.Checks @@ -12,7 +13,8 @@ public class IndexerRssCheck : HealthCheckBase { private readonly IIndexerFactory _indexerFactory; - public IndexerRssCheck(IIndexerFactory indexerFactory) + public IndexerRssCheck(IIndexerFactory indexerFactory, ILocalizationService localizationService) + : base(localizationService) { _indexerFactory = indexerFactory; } @@ -23,14 +25,14 @@ public override HealthCheck Check() if (enabled.Empty()) { - return new HealthCheck(GetType(), HealthCheckResult.Error, "No indexers available with RSS sync enabled, Radarr will not grab new releases automatically"); + return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("IndexerRssHealthCheckNoIndexers")); } var active = _indexerFactory.RssEnabled(true); if (active.Empty()) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "All rss-capable indexers are temporarily unavailable due to recent indexer errors"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerRssHealthCheckNoAvailableIndexers")); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/IndexerSearchCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/IndexerSearchCheck.cs index 5798535ee..5b00a7a53 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/IndexerSearchCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/IndexerSearchCheck.cs @@ -1,5 +1,6 @@ -using NzbDrone.Common.Extensions; +using NzbDrone.Common.Extensions; using NzbDrone.Core.Indexers; +using NzbDrone.Core.Localization; using NzbDrone.Core.ThingiProvider.Events; namespace NzbDrone.Core.HealthCheck.Checks @@ -12,7 +13,8 @@ public class IndexerSearchCheck : HealthCheckBase { private readonly IIndexerFactory _indexerFactory; - public IndexerSearchCheck(IIndexerFactory indexerFactory) + public IndexerSearchCheck(IIndexerFactory indexerFactory, ILocalizationService localizationService) + : base(localizationService) { _indexerFactory = indexerFactory; } @@ -23,21 +25,21 @@ public override HealthCheck Check() if (automaticSearchEnabled.Empty()) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Automatic Search enabled, Radarr will not provide any automatic search results"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoAutomaticMessage")); } var interactiveSearchEnabled = _indexerFactory.InteractiveSearchEnabled(false); if (interactiveSearchEnabled.Empty()) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Interactive Search enabled, Radarr will not provide any interactive search results"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoInteractiveMessage")); } var active = _indexerFactory.AutomaticSearchEnabled(true); if (active.Empty()) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "All search-capable indexers are temporarily unavailable due to recent indexer errors"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoAvailableIndexersMessage")); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/IndexerStatusCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/IndexerStatusCheck.cs index dd80c0bec..1d4b9ba95 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/IndexerStatusCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/IndexerStatusCheck.cs @@ -1,6 +1,7 @@ using System.Linq; using NzbDrone.Common.Extensions; using NzbDrone.Core.Indexers; +using NzbDrone.Core.Localization; using NzbDrone.Core.ThingiProvider.Events; namespace NzbDrone.Core.HealthCheck.Checks @@ -13,7 +14,8 @@ public class IndexerStatusCheck : HealthCheckBase private readonly IIndexerFactory _providerFactory; private readonly IIndexerStatusService _providerStatusService; - public IndexerStatusCheck(IIndexerFactory providerFactory, IIndexerStatusService providerStatusService) + public IndexerStatusCheck(IIndexerFactory providerFactory, IIndexerStatusService providerStatusService, ILocalizationService localizationService) + : base(localizationService) { _providerFactory = providerFactory; _providerStatusService = providerStatusService; @@ -35,10 +37,10 @@ public override HealthCheck Check() if (backOffProviders.Count == enabledProviders.Count) { - return new HealthCheck(GetType(), HealthCheckResult.Error, "All indexers are unavailable due to failures", "#indexers-are-unavailable-due-to-failures"); + return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("IndexerStatusCheckAllClientMessage"), "#indexers-are-unavailable-due-to-failures"); } - return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Indexers unavailable due to failures: {0}", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#indexers-are-unavailable-due-to-failures"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("IndexerStatusCheckSingleClientMessage"), string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#indexers-are-unavailable-due-to-failures"); } } } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MediaInfoDllCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MediaInfoDllCheck.cs index b8ca565c5..5a6710d66 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/MediaInfoDllCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/MediaInfoDllCheck.cs @@ -1,11 +1,17 @@ -using System; +using System; using System.Runtime.CompilerServices; +using NzbDrone.Core.Localization; using NzbDrone.Core.MediaFiles.MediaInfo; namespace NzbDrone.Core.HealthCheck.Checks { public class MediaInfoDllCheck : HealthCheckBase { + public MediaInfoDllCheck(ILocalizationService localizationService) + : base(localizationService) + { + } + [MethodImpl(MethodImplOptions.NoOptimization)] public override HealthCheck Check() { @@ -15,7 +21,7 @@ public override HealthCheck Check() } catch (Exception e) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, $"MediaInfo Library could not be loaded {e.Message}"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("MediaInfoDllCheckMessage"), e.Message)); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MonoDebugCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MonoDebugCheck.cs index 3296c199f..bb0a96c70 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/MonoDebugCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/MonoDebugCheck.cs @@ -1,7 +1,8 @@ -using System.Diagnostics; +using System.Diagnostics; using NLog; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Extensions; +using NzbDrone.Core.Localization; namespace NzbDrone.Core.HealthCheck.Checks { @@ -12,7 +13,8 @@ public class MonoDebugCheck : HealthCheckBase public override bool CheckOnSchedule => false; - public MonoDebugCheck(Logger logger, StackFrameHelper stackFrameHelper) + public MonoDebugCheck(Logger logger, StackFrameHelper stackFrameHelper, ILocalizationService localizationService) + : base(localizationService) { _logger = logger; _stackFrameHelper = stackFrameHelper; diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MonoNotNetCoreCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MonoNotNetCoreCheck.cs index 36d372cf7..3855dee3b 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/MonoNotNetCoreCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/MonoNotNetCoreCheck.cs @@ -1,8 +1,9 @@ -using System.Linq; +using System.Linq; using System.Runtime.InteropServices; using NLog; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Processes; +using NzbDrone.Core.Localization; namespace NzbDrone.Core.HealthCheck.Checks { @@ -14,7 +15,9 @@ public class MonoNotNetCoreCheck : HealthCheckBase public MonoNotNetCoreCheck(IOsInfo osInfo, IProcessProvider processProvider, + ILocalizationService localizationService, Logger logger) + : base(localizationService) { _osInfo = osInfo; _processProvider = processProvider; @@ -42,7 +45,7 @@ public override HealthCheck Check() return new HealthCheck(GetType(), HealthCheckResult.Warning, - "Please upgrade to the .NET Core version of Radarr", + _localizationService.GetLocalizedString("MonoNotNetCoreCheckMessage"), "#update-to-net-core-version"); } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MonoTlsCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MonoTlsCheck.cs index f06736671..2284ab3a5 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/MonoTlsCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/MonoTlsCheck.cs @@ -1,8 +1,9 @@ -using System; +using System; using NLog; using NLog.Fluent; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Instrumentation.Extensions; +using NzbDrone.Core.Localization; namespace NzbDrone.Core.HealthCheck.Checks { @@ -11,7 +12,8 @@ public class MonoTlsCheck : HealthCheckBase private readonly IPlatformInfo _platformInfo; private readonly Logger _logger; - public MonoTlsCheck(IPlatformInfo platformInfo, Logger logger) + public MonoTlsCheck(IPlatformInfo platformInfo, ILocalizationService localizationService, Logger logger) + : base(localizationService) { _platformInfo = platformInfo; _logger = logger; @@ -33,7 +35,7 @@ public override HealthCheck Check() .WriteSentryDebug("LegacyTlsProvider", monoVersion.ToString()) .Write(); - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Sonarr Mono 4.x tls workaround still enabled, consider removing MONO_TLS_PROVIDER=legacy environment option"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("MonoTlsCheckMessage")); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MonoVersionCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MonoVersionCheck.cs index 70d3dd68a..d17b122ac 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/MonoVersionCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/MonoVersionCheck.cs @@ -1,6 +1,7 @@ using System; using NLog; using NzbDrone.Common.EnvironmentInfo; +using NzbDrone.Core.Localization; namespace NzbDrone.Core.HealthCheck.Checks { @@ -9,7 +10,8 @@ public class MonoVersionCheck : HealthCheckBase private readonly IPlatformInfo _platformInfo; private readonly Logger _logger; - public MonoVersionCheck(IPlatformInfo platformInfo, Logger logger) + public MonoVersionCheck(IPlatformInfo platformInfo, ILocalizationService localizationService, Logger logger) + : base(localizationService) { _platformInfo = platformInfo; _logger = logger; diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs index 7c61a95e3..c690c08f7 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs @@ -1,6 +1,7 @@ using System.Linq; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; +using NzbDrone.Core.Localization; using NzbDrone.Core.Movies; namespace NzbDrone.Core.HealthCheck.Checks @@ -10,7 +11,8 @@ public class MountCheck : HealthCheckBase private readonly IDiskProvider _diskProvider; private readonly IMovieService _movieService; - public MountCheck(IDiskProvider diskProvider, IMovieService movieService) + public MountCheck(IDiskProvider diskProvider, IMovieService movieService, ILocalizationService localizationService) + : base(localizationService) { _diskProvider = diskProvider; _movieService = movieService; @@ -27,7 +29,7 @@ public override HealthCheck Check() if (mounts.Any()) { - return new HealthCheck(GetType(), HealthCheckResult.Error, "Mount containing a movie path is mounted read-only: " + string.Join(",", mounts.Select(m => m.Name)), "#movie-mount-ro"); + return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("MountCheckMessage") + string.Join(", ", mounts.Select(m => m.Name)), "#movie-mount-ro"); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/NetImportStatusCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/NetImportStatusCheck.cs index a72f9087e..beccb3487 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/NetImportStatusCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/NetImportStatusCheck.cs @@ -1,5 +1,6 @@ using System.Linq; using NzbDrone.Common.Extensions; +using NzbDrone.Core.Localization; using NzbDrone.Core.NetImport; using NzbDrone.Core.ThingiProvider.Events; @@ -13,7 +14,8 @@ public class NetImportStatusCheck : HealthCheckBase private readonly INetImportFactory _providerFactory; private readonly INetImportStatusService _providerStatusService; - public NetImportStatusCheck(INetImportFactory providerFactory, INetImportStatusService providerStatusService) + public NetImportStatusCheck(INetImportFactory providerFactory, INetImportStatusService providerStatusService, ILocalizationService localizationService) + : base(localizationService) { _providerFactory = providerFactory; _providerStatusService = providerStatusService; @@ -35,10 +37,10 @@ public override HealthCheck Check() if (backOffProviders.Count == enabledProviders.Count) { - return new HealthCheck(GetType(), HealthCheckResult.Error, "All lists are unavailable due to failures", "#lists-are-unavailable-due-to-failures"); + return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("NetImportStatusCheckAllClientMessage"), "#lists-are-unavailable-due-to-failures"); } - return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Lists unavailable due to failures: {0}", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#lists-are-unavailable-due-to-failures"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("NetImportStatusCheckSingleClientMessage"), string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#lists-are-unavailable-due-to-failures"); } } } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/PTPOldSettingsCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/PTPOldSettingsCheck.cs index 70c99532b..9e611a328 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/PTPOldSettingsCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/PTPOldSettingsCheck.cs @@ -2,6 +2,7 @@ using NzbDrone.Common.Extensions; using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers.PassThePopcorn; +using NzbDrone.Core.Localization; namespace NzbDrone.Core.HealthCheck.Checks { @@ -9,7 +10,8 @@ public class PTPOldSettingsCheck : HealthCheckBase { private readonly IIndexerFactory _indexerFactory; - public PTPOldSettingsCheck(IIndexerFactory indexerFactory) + public PTPOldSettingsCheck(IIndexerFactory indexerFactory, ILocalizationService localizationService) + : base(localizationService) { _indexerFactory = indexerFactory; } @@ -23,7 +25,7 @@ public override HealthCheck Check() if (ptpIndexerOldSettings.Count() > 0) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, $"The following PassThePopcorn indexers have deprecated settings and should be updated: {string.Join(",", ptpIndexerOldSettings)}"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("PtpOldSettingsCheckMessage"), string.Join(", ", ptpIndexerOldSettings))); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/ProxyCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/ProxyCheck.cs index e6b0b7576..7ac940c16 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/ProxyCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/ProxyCheck.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Net; using NLog; @@ -6,6 +6,7 @@ using NzbDrone.Common.Http; using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration.Events; +using NzbDrone.Core.Localization; namespace NzbDrone.Core.HealthCheck.Checks { @@ -18,7 +19,8 @@ public class ProxyCheck : HealthCheckBase private readonly IHttpRequestBuilderFactory _cloudRequestBuilder; - public ProxyCheck(IRadarrCloudRequestBuilder cloudRequestBuilder, IConfigService configService, IHttpClient client, Logger logger) + public ProxyCheck(IRadarrCloudRequestBuilder cloudRequestBuilder, IConfigService configService, IHttpClient client, ILocalizationService localizationService, Logger logger) + : base(localizationService) { _configService = configService; _client = client; @@ -34,7 +36,7 @@ public override HealthCheck Check() var addresses = Dns.GetHostAddresses(_configService.ProxyHostname); if (!addresses.Any()) { - return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Failed to resolve the IP Address for the Configured Proxy Host {0}", _configService.ProxyHostname)); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ProxyCheckResolveIpMessage"), _configService.ProxyHostname)); } var request = _cloudRequestBuilder.Create() @@ -49,13 +51,13 @@ public override HealthCheck Check() if (response.StatusCode == HttpStatusCode.BadRequest) { _logger.Error("Proxy Health Check failed: {0}", response.StatusCode); - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Failed to test proxy. StatusCode: {response.StatusCode}"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ProxyCheckBadRequestMessage"), response.StatusCode)); } } catch (Exception ex) { _logger.Error(ex, "Proxy Health Check failed"); - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Failed to test proxy: {request.Url}"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ProxyCheckFailedToTestMessage"), request.Url)); } } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/ReleaseBranchCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/ReleaseBranchCheck.cs index 48c29511a..b1de1b4d7 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/ReleaseBranchCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/ReleaseBranchCheck.cs @@ -2,6 +2,7 @@ using System.Linq; using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration.Events; +using NzbDrone.Core.Localization; namespace NzbDrone.Core.HealthCheck.Checks { @@ -10,7 +11,8 @@ public class ReleaseBranchCheck : HealthCheckBase { private readonly IConfigFileProvider _configFileService; - public ReleaseBranchCheck(IConfigFileProvider configFileService) + public ReleaseBranchCheck(IConfigFileProvider configFileService, ILocalizationService localizationService) + : base(localizationService) { _configFileService = configFileService; } @@ -23,10 +25,10 @@ public override HealthCheck Check() { if (currentBranch == "develop" || currentBranch == "nightly") { - return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Branch {0} is for a previous version of Radarr, set branch to 'Aphrodite' for further updates", _configFileService.Branch), "#branch-is-for-a-previous-version"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ReleaseBranchCheckPreviousVersionMessage"), _configFileService.Branch), "#branch-is-for-a-previous-version"); } - return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Branch {0} is not a valid Radarr release branch, you will not receive updates", _configFileService.Branch), "#branch-is-not-a-valid-release-branch"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("ReleaseBranchCheckOfficialBranchMessage"), _configFileService.Branch), "#branch-is-not-a-valid-release-branch"); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/RemotePathMappingCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/RemotePathMappingCheck.cs index 78591cd58..9f9b783ff 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/RemotePathMappingCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/RemotePathMappingCheck.cs @@ -8,6 +8,7 @@ using NzbDrone.Core.Datastore.Events; using NzbDrone.Core.Download; using NzbDrone.Core.Download.Clients; +using NzbDrone.Core.Localization; using NzbDrone.Core.MediaFiles.Events; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.ThingiProvider.Events; @@ -30,7 +31,9 @@ public class RemotePathMappingCheck : HealthCheckBase, IProvideHealthCheck public RemotePathMappingCheck(IDiskProvider diskProvider, IProvideDownloadClient downloadClientProvider, IOsInfo osInfo, - Logger logger) + Logger logger, + ILocalizationService localizationService) + : base(localizationService) { _diskProvider = diskProvider; _downloadClientProvider = downloadClientProvider; diff --git a/src/NzbDrone.Core/HealthCheck/Checks/RemovedMovieCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/RemovedMovieCheck.cs index 6f4745478..523de6634 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/RemovedMovieCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/RemovedMovieCheck.cs @@ -1,5 +1,6 @@ using System.Linq; using NzbDrone.Common.Extensions; +using NzbDrone.Core.Localization; using NzbDrone.Core.Movies; using NzbDrone.Core.Movies.Events; @@ -7,11 +8,12 @@ namespace NzbDrone.Core.HealthCheck.Checks { [CheckOn(typeof(MovieUpdatedEvent))] [CheckOn(typeof(MoviesDeletedEvent), CheckOnCondition.FailedOnly)] - public class RemovedSeriesCheck : HealthCheckBase, ICheckOnCondition, ICheckOnCondition + public class RemovedMovieCheck : HealthCheckBase, ICheckOnCondition, ICheckOnCondition { private readonly IMovieService _movieService; - public RemovedSeriesCheck(IMovieService movieService) + public RemovedMovieCheck(IMovieService movieService, ILocalizationService localizationService) + : base(localizationService) { _movieService = movieService; } @@ -29,10 +31,10 @@ public override HealthCheck Check() if (deletedMovie.Count == 1) { - return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Movie {0} was removed from TMDb", movieText), "#movie-was-removed-from-tmdb"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemovedMovieCheckSingleMessage"), movieText), "#movie-was-removed-from-tmdb"); } - return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Movie {0} was removed from TMDb", movieText), "#movie-was-removed-from-tmdb"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemovedMovieCheckMultipleMessage"), movieText), "#movie-was-removed-from-tmdb"); } public bool ShouldCheckOnEvent(MoviesDeletedEvent message) diff --git a/src/NzbDrone.Core/HealthCheck/Checks/RootFolderCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/RootFolderCheck.cs index 574a4ba86..5a73b3f8a 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/RootFolderCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/RootFolderCheck.cs @@ -1,5 +1,6 @@ using System.Linq; using NzbDrone.Common.Disk; +using NzbDrone.Core.Localization; using NzbDrone.Core.MediaFiles.Events; using NzbDrone.Core.Movies; using NzbDrone.Core.Movies.Events; @@ -17,7 +18,8 @@ public class RootFolderCheck : HealthCheckBase private readonly IDiskProvider _diskProvider; private readonly IRootFolderService _rootFolderService; - public RootFolderCheck(IMovieService movieService, IDiskProvider diskProvider, IRootFolderService rootFolderService) + public RootFolderCheck(IMovieService movieService, IDiskProvider diskProvider, IRootFolderService rootFolderService, ILocalizationService localizationService) + : base(localizationService) { _movieService = movieService; _diskProvider = diskProvider; @@ -37,10 +39,10 @@ public override HealthCheck Check() { if (missingRootFolders.Count == 1) { - return new HealthCheck(GetType(), HealthCheckResult.Error, "Missing root folder: " + missingRootFolders.First(), "#missing-root-folder"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RootFolderCheckSingleMessage"), missingRootFolders.First()), "#missing-root-folder"); } - var message = string.Format("Multiple root folders are missing: {0}", string.Join(" | ", missingRootFolders)); + var message = string.Format(_localizationService.GetLocalizedString("RootFolderCheckMultipleMessage"), string.Join(" | ", missingRootFolders)); return new HealthCheck(GetType(), HealthCheckResult.Error, message, "#missing-root-folder"); } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs index f9a923095..b012d5c17 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs @@ -5,6 +5,7 @@ using NzbDrone.Common.Extensions; using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration.Events; +using NzbDrone.Core.Localization; using NzbDrone.Core.Update; namespace NzbDrone.Core.HealthCheck.Checks @@ -22,7 +23,9 @@ public UpdateCheck(IDiskProvider diskProvider, IAppFolderInfo appFolderInfo, ICheckUpdateService checkUpdateService, IConfigFileProvider configFileProvider, - IOsInfo osInfo) + IOsInfo osInfo, + ILocalizationService localizationService) + : base(localizationService) { _diskProvider = diskProvider; _appFolderInfo = appFolderInfo; @@ -44,7 +47,7 @@ public override HealthCheck Check() { return new HealthCheck(GetType(), HealthCheckResult.Error, - string.Format("Cannot install update because startup folder '{0}' is in an App Translocation folder.", startupFolder), + string.Format(_localizationService.GetLocalizedString("UpdateCheckStartupTranslocationMessage"), startupFolder), "#cannot-install-update-because-startup-folder-is-in-an-app-translocation-folder."); } @@ -52,7 +55,7 @@ public override HealthCheck Check() { return new HealthCheck(GetType(), HealthCheckResult.Error, - string.Format("Cannot install update because startup folder '{0}' is not writable by the user '{1}'.", startupFolder, Environment.UserName), + string.Format(_localizationService.GetLocalizedString("UpdateCheckStartupNotWritableMessage"), startupFolder, Environment.UserName), "#cannot-install-update-because-startup-folder-is-not-writable-by-the-user"); } @@ -60,7 +63,7 @@ public override HealthCheck Check() { return new HealthCheck(GetType(), HealthCheckResult.Error, - string.Format("Cannot install update because UI folder '{0}' is not writable by the user '{1}'.", uiFolder, Environment.UserName), + string.Format(_localizationService.GetLocalizedString("UpdateCheckUINotWritableMessage"), uiFolder, Environment.UserName), "#cannot-install-update-because-ui-folder-is-not-writable-by-the-user"); } } diff --git a/src/NzbDrone.Core/HealthCheck/HealthCheckBase.cs b/src/NzbDrone.Core/HealthCheck/HealthCheckBase.cs index 0d05d0454..24a90037e 100644 --- a/src/NzbDrone.Core/HealthCheck/HealthCheckBase.cs +++ b/src/NzbDrone.Core/HealthCheck/HealthCheckBase.cs @@ -1,7 +1,15 @@ -namespace NzbDrone.Core.HealthCheck +using NzbDrone.Core.Localization; + +namespace NzbDrone.Core.HealthCheck { public abstract class HealthCheckBase : IProvideHealthCheck { + public readonly ILocalizationService _localizationService; + public HealthCheckBase(ILocalizationService localizationService) + { + _localizationService = localizationService; + } + public abstract HealthCheck Check(); public virtual bool CheckOnStartup => true;