diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoNotNetCoreCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoNotNetCoreCheckFixture.cs index 6e416acc1..040b6d4a2 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoNotNetCoreCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoNotNetCoreCheckFixture.cs @@ -1,7 +1,9 @@ using System.Collections.Generic; +using Moq; using NUnit.Framework; using NzbDrone.Common.Processes; 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 MonoNotNetCoreCheckFixture : CoreTest { + [SetUp] + public void setup() + { + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); + } + [Test] [Platform(Exclude = "Mono")] public void should_return_ok_if_net_core() diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/RemotePathMappingCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/RemotePathMappingCheckFixture.cs index ef8dc8314..5d94bfa28 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/RemotePathMappingCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/RemotePathMappingCheckFixture.cs @@ -10,6 +10,7 @@ using NzbDrone.Core.Download; using NzbDrone.Core.Download.Clients; using NzbDrone.Core.HealthCheck.Checks; +using NzbDrone.Core.Localization; using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles.Events; using NzbDrone.Core.Parser.Model; @@ -84,6 +85,10 @@ public void Setup() Ensure.That(path, () => path).IsValidPath(); return false; }); + + Mocker.GetMock() + .Setup(s => s.GetLocalizedString(It.IsAny())) + .Returns("Some Warning Message"); } private void GivenFolderExists(string folder) diff --git a/src/NzbDrone.Core/HealthCheck/Checks/ImportListRootFolderCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/ImportListRootFolderCheck.cs index 21f21a774..229da058b 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/ImportListRootFolderCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/ImportListRootFolderCheck.cs @@ -50,10 +50,10 @@ public override HealthCheck Check() if (missingRootFolders.Count == 1) { var missingRootFolder = missingRootFolders.First(); - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Missing root folder for import list(s): {FormatRootFolder(missingRootFolder.Key, missingRootFolder.Value)}", "#import_list_missing_root_folder"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ImportListMissingRoot"), FormatRootFolder(missingRootFolder.Key, missingRootFolder.Value)), "#import_list_missing_root_folder"); } - var message = string.Format("Multiple root folders are missing for import lists: {0}", string.Join(" | ", missingRootFolders.Select(m => FormatRootFolder(m.Key, m.Value)))); + var message = string.Format(_localizationService.GetLocalizedString("ImportListMultipleMissingRoots"), string.Join(" | ", missingRootFolders.Select(m => FormatRootFolder(m.Key, m.Value)))); return new HealthCheck(GetType(), HealthCheckResult.Error, message, "#import_list_missing_root_folder"); } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/RemotePathMappingCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/RemotePathMappingCheck.cs index 8ec38fc97..146c1ec01 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/RemotePathMappingCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/RemotePathMappingCheck.cs @@ -69,15 +69,15 @@ public override HealthCheck Check() { if (!status.IsLocalhost) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Remote download client {client.Definition.Name} places downloads in {folder.FullPath} but this is not a valid {_osInfo.Name} path. Review your remote path mappings and download client settings.", "#bad_remote_path_mapping"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckWrongOSPath"), client.Definition.Name, folder.FullPath, _osInfo.Name), "#bad_remote_path_mapping"); } else if (_osInfo.IsDocker) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"You are using docker; download client {client.Definition.Name} places downloads in {folder.FullPath} but this is not a valid {_osInfo.Name} path. Review your remote path mappings and download client settings.", "#docker_bad_remote_path_mapping"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckBadDockerPath"), client.Definition.Name, folder.FullPath, _osInfo.Name), "#docker_bad_remote_path_mapping"); } else { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Local download client {client.Definition.Name} places downloads in {folder.FullPath} but this is not a valid {_osInfo.Name} path. Review your download client settings.", "#bad_download_client_settings"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckLocalWrongOSPath"), client.Definition.Name, folder.FullPath, _osInfo.Name), "#bad_download_client_settings"); } } @@ -85,15 +85,15 @@ public override HealthCheck Check() { if (_osInfo.IsDocker) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"You are using docker; download client {client.Definition.Name} places downloads in {folder.FullPath} but this directory does not appear to exist inside the container. Review your remote path mappings and container volume settings.", "#docker_bad_remote_path_mapping"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckDockerFolderMissing"), client.Definition.Name, folder.FullPath), "#docker_bad_remote_path_mapping"); } else if (!status.IsLocalhost) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Remote download client {client.Definition.Name} places downloads in {folder.FullPath} but this directory does not appear to exist. Likely missing or incorrect remote path mapping.", "#bad_remote_path_mapping"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckLocalFolderMissing"), client.Definition.Name, folder.FullPath), "#bad_remote_path_mapping"); } else { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Download client {client.Definition.Name} places downloads in {folder.FullPath} but Radarr cannot see this directory. You may need to adjust the folder's permissions.", "#permissions_error"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckGenericPermissions"), client.Definition.Name, folder.FullPath), "#permissions_error"); } } } @@ -130,13 +130,13 @@ public HealthCheck Check(IEvent message) var moviePath = failureMessage.MovieInfo.Path; if (_diskProvider.FileExists(moviePath)) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Radarr can see but not access downloaded movie {moviePath}. Likely permissions error.", "#permissions_error"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckDownloadPermissions"), moviePath), "#permissions_error"); } else { // If the file doesn't exist but MovieInfo is not null then the message is coming from // ImportApprovedMovies and the file must have been removed part way through processing - return new HealthCheck(GetType(), HealthCheckResult.Error, $"File {moviePath} was removed part way though procesing."); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFileRemoved"), moviePath)); } } @@ -152,43 +152,43 @@ public HealthCheck Check(IEvent message) // that the user realises something is wrong. if (dlpath.IsNullOrWhiteSpace()) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Radarr failed to import a movie. Check your logs for details."); + return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("RemotePathMappingCheckImportFailed")); } if (!dlpath.IsPathValid()) { if (!status.IsLocalhost) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Remote download client {client.Definition.Name} reported files in {dlpath} but this is not a valid {_osInfo.Name} path. Review your remote path mappings and download client settings.", "#bad_remote_path_mapping"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFilesWrongOSPath"), client.Definition.Name, dlpath, _osInfo.Name), "#bad_remote_path_mapping"); } else if (_osInfo.IsDocker) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"You are using docker; download client {client.Definition.Name} reported files in {dlpath} but this is not a valid {_osInfo.Name} path. Review your remote path mappings and download client settings.", "#docker_bad_remote_path_mapping"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFilesBadDockerPath"), client.Definition.Name, dlpath, _osInfo.Name), "#docker_bad_remote_path_mapping"); } else { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Local download client {client.Definition.Name} reported files in {dlpath} but this is not a valid {_osInfo.Name} path. Review your download client settings.", "#bad_download_client_settings"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFilesLocalWrongOSPath"), client.Definition.Name, dlpath, _osInfo.Name), "#bad_download_client_settings"); } } if (_diskProvider.FolderExists(dlpath)) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Radarr can see but not access download directory {dlpath}. Likely permissions error.", "#permissions_error"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFolderPermissions"), dlpath), "#permissions_error"); } // if it's a remote client/docker, likely missing path mappings if (_osInfo.IsDocker) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"You are using docker; download client {client.Definition.Name} reported files in {dlpath} but this directory does not appear to exist inside the container. Review your remote path mappings and container volume settings.", "#docker_bad_remote_path_mapping"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFolderPermissions"), client.Definition.Name, dlpath), "#docker_bad_remote_path_mapping"); } else if (!status.IsLocalhost) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Remote download client {client.Definition.Name} reported files in {dlpath} but this directory does not appear to exist. Likely missing remote path mapping.", "#bad_remote_path_mapping"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckRemoteDownloadClient"), client.Definition.Name, dlpath), "#bad_remote_path_mapping"); } else { // path mappings shouldn't be needed locally so probably a permissions issue - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Download client {client.Definition.Name} reported files in {dlpath} but Radarr cannot see this directory. You may need to adjust the folder's permissions.", "#permissions_error"); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFilesGenericPermissions"), client.Definition.Name, dlpath), "#permissions_error"); } } catch (DownloadClientException ex) diff --git a/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs index a9545d718..8eac0310b 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs @@ -68,12 +68,9 @@ public override HealthCheck Check() } } - if (BuildInfo.BuildDateTime < DateTime.UtcNow.AddDays(-14)) + if (BuildInfo.BuildDateTime < DateTime.UtcNow.AddDays(-14) && _checkUpdateService.AvailableUpdate() != null) { - if (_checkUpdateService.AvailableUpdate() != null) - { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "New update is available"); - } + return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("UpdateAvailable")); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index 7eb0c4091..3cf2c9feb 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -394,6 +394,8 @@ "ImportIncludeQuality": "Make sure that your files include the quality in their filenames. e.g. {0}", "Importing": "Importing", "ImportLibrary": "Library Import", + "ImportListMissingRoot": "Missing root folder for import list(s): {0}", + "ImportListMultipleMissingRoots": "Multiple root folders are missing for import lists: {0}", "ImportListStatusCheckAllClientMessage": "All lists are unavailable due to failures", "ImportListStatusCheckSingleClientMessage": "Lists unavailable due to failures: {0}", "ImportListSyncIntervalHelpText": "How often Radarr syncs with your lists. Minimum value of 6 hours", @@ -757,6 +759,22 @@ "ReleaseWillBeProcessedInterp": "Release will be processed {0}", "Reload": "Reload", "RemotePathMappings": "Remote Path Mappings", + "RemotePathMappingCheckBadDockerPath": "You are using docker; download client {0} places downloads in {1} but this is not a valid {2} path. Review your remote path mappings and download client settings.", + "RemotePathMappingCheckDockerFolderMissing": "You are using docker; download client {0} places downloads in {1} but this directory does not appear to exist inside the container. Review your remote path mappings and container volume settings.", + "RemotePathMappingCheckLocalFolderMissing": "Remote download client {0} places downloads in {1} but this directory does not appear to exist. Likely missing or incorrect remote path mapping.", + "RemotePathMappingCheckLocalWrongOSPath": "Local download client {0} places downloads in {1} but this is not a valid {2} path. Review your download client settings.", + "RemotePathMappingCheckWrongOSPath": "Remote download client {0} places downloads in {1} but this is not a valid {2} path. Review your remote path mappings and download client settings.", + "RemotePathMappingCheckGenericPermissions": "Download client {0} places downloads in {1} but Radarr cannot see this directory. You may need to adjust the folder's permissions.", + "RemotePathMappingCheckDownloadPermissions": "Radarr can see but not access downloaded movie {0}. Likely permissions error.", + "RemotePathMappingCheckFileRemoved": "File {0} was removed part way through processing.", + "RemotePathMappingCheckImportFailed": "Radarr failed to import a movie. Check your logs for details.", + "RemotePathMappingCheckFilesWrongOSPath": "Remote download client {0} reported files in {1} but this is not a valid {2} path. Review your remote path mappings and download client settings.", + "RemotePathMappingCheckFilesBadDockerPath": "You are using docker; download client {0} reported files in {1} but this is not a valid {2} path. Review your remote path mappings and download client settings.", + "RemotePathMappingCheckFilesLocalWrongOSPath": "Local download client {0} reported files in {1} but this is not a valid {2} path. Review your download client settings.", + "RemotePathMappingCheckFolderPermissions": "Radarr can see but not access download directory {0}. Likely permissions error.", + "RemotePathMappingCheckDockerFilesMissing": "You are using docker; download client {0} reported files in {1} but this directory does not appear to exist inside the container. Review your remote path mappings and container volume settings.", + "RemotePathMappingCheckRemoteDownloadClient": "Remote download client {0} reported files in {1} but this directory does not appear to exist. Likely missing remote path mapping.", + "RemotePathMappingCheckFilesGenericPermissions": "Download client {0} reported files in {1} but Radarr cannot see this directory. You may need to adjust the folder's permissions.", "Remove": "Remove", "RemoveCompletedDownloadsHelpText": "Remove imported downloads from download client history", "RemovedFromTaskQueue": "Removed from task queue", @@ -1030,6 +1048,7 @@ "UnselectAll": "Unselect All", "UpdateAll": "Update All", "UpdateAutomaticallyHelpText": "Automatically download and install updates. You will still be able to install from System: Updates", + "UpdateAvailable": "New update is available", "UpdateCheckStartupNotWritableMessage": "Cannot install update because startup folder '{0}' is not writable by the user '{1}'.", "UpdateCheckStartupTranslocationMessage": "Cannot install update because startup folder '{0}' is in an App Translocation folder.", "UpdateCheckUINotWritableMessage": "Cannot install update because UI folder '{0}' is not writable by the user '{1}'.",