From f8704a16557669aa56f1eb8578ee2a935b59721d Mon Sep 17 00:00:00 2001 From: Stevie Robinson Date: Sun, 14 Jan 2024 21:57:42 +0100 Subject: [PATCH] Translate backend: Autotagging + CF specs Signed-off-by: Stevie Robinson (cherry picked from commit de1cc25c903924fecbca79fedb458d729ae584fd) Towards #9647 --- .../Specifications/GenreSpecification.cs | 2 +- .../OriginalLanguageSpecification.cs | 2 +- .../QualityProfileSpecification.cs | 2 +- .../Specifications/RootFolderSpecification.cs | 2 +- .../Specifications/RuntimeSpecification.cs | 4 ++-- .../Specifications/YearSpecification.cs | 4 ++-- .../Specifications/LanguageSpecification.cs | 2 +- .../QualityModifierSpecification.cs | 2 +- .../Specifications/ResolutionSpecification.cs | 2 +- .../Specifications/SizeSpecification.cs | 4 ++-- .../Specifications/SourceSpecification.cs | 2 +- .../Specifications/YearSpecification.cs | 4 ++-- src/NzbDrone.Core/Localization/Core/en.json | 18 ++++++++++++++++++ src/Radarr.Http/ClientSchema/SchemaBuilder.cs | 7 ++++++- 14 files changed, 40 insertions(+), 17 deletions(-) diff --git a/src/NzbDrone.Core/AutoTagging/Specifications/GenreSpecification.cs b/src/NzbDrone.Core/AutoTagging/Specifications/GenreSpecification.cs index c4548888a..77de3a541 100644 --- a/src/NzbDrone.Core/AutoTagging/Specifications/GenreSpecification.cs +++ b/src/NzbDrone.Core/AutoTagging/Specifications/GenreSpecification.cs @@ -23,7 +23,7 @@ namespace NzbDrone.Core.AutoTagging.Specifications public override int Order => 1; public override string ImplementationName => "Genre"; - [FieldDefinition(1, Label = "Genre(s)", Type = FieldType.Tag)] + [FieldDefinition(1, Label = "AutoTaggingSpecificationGenre", Type = FieldType.Tag)] public IEnumerable Value { get; set; } protected override bool IsSatisfiedByWithoutNegate(Movie movie) diff --git a/src/NzbDrone.Core/AutoTagging/Specifications/OriginalLanguageSpecification.cs b/src/NzbDrone.Core/AutoTagging/Specifications/OriginalLanguageSpecification.cs index 3e47e1925..547fb381f 100644 --- a/src/NzbDrone.Core/AutoTagging/Specifications/OriginalLanguageSpecification.cs +++ b/src/NzbDrone.Core/AutoTagging/Specifications/OriginalLanguageSpecification.cs @@ -21,7 +21,7 @@ namespace NzbDrone.Core.AutoTagging.Specifications public override int Order => 1; public override string ImplementationName => "Original Language"; - [FieldDefinition(1, Label = "Language", Type = FieldType.Select, SelectOptions = typeof(OriginalLanguageFieldConverter))] + [FieldDefinition(1, Label = "AutoTaggingSpecificationOriginalLanguage", Type = FieldType.Select, SelectOptions = typeof(OriginalLanguageFieldConverter))] public int Value { get; set; } protected override bool IsSatisfiedByWithoutNegate(Movie movie) diff --git a/src/NzbDrone.Core/AutoTagging/Specifications/QualityProfileSpecification.cs b/src/NzbDrone.Core/AutoTagging/Specifications/QualityProfileSpecification.cs index a698bc015..e7a3e2371 100644 --- a/src/NzbDrone.Core/AutoTagging/Specifications/QualityProfileSpecification.cs +++ b/src/NzbDrone.Core/AutoTagging/Specifications/QualityProfileSpecification.cs @@ -20,7 +20,7 @@ namespace NzbDrone.Core.AutoTagging.Specifications public override int Order => 1; public override string ImplementationName => "Quality Profile"; - [FieldDefinition(1, Label = "Quality Profile", Type = FieldType.QualityProfile)] + [FieldDefinition(1, Label = "AutoTaggingSpecificationQualityProfile", Type = FieldType.QualityProfile)] public int Value { get; set; } protected override bool IsSatisfiedByWithoutNegate(Movie movie) diff --git a/src/NzbDrone.Core/AutoTagging/Specifications/RootFolderSpecification.cs b/src/NzbDrone.Core/AutoTagging/Specifications/RootFolderSpecification.cs index 2ff8bb24d..553a4ca57 100644 --- a/src/NzbDrone.Core/AutoTagging/Specifications/RootFolderSpecification.cs +++ b/src/NzbDrone.Core/AutoTagging/Specifications/RootFolderSpecification.cs @@ -22,7 +22,7 @@ namespace NzbDrone.Core.AutoTagging.Specifications public override int Order => 1; public override string ImplementationName => "Root Folder"; - [FieldDefinition(1, Label = "Root Folder", Type = FieldType.RootFolder)] + [FieldDefinition(1, Label = "AutoTaggingSpecificationRootFolder", Type = FieldType.RootFolder)] public string Value { get; set; } protected override bool IsSatisfiedByWithoutNegate(Movie movie) diff --git a/src/NzbDrone.Core/AutoTagging/Specifications/RuntimeSpecification.cs b/src/NzbDrone.Core/AutoTagging/Specifications/RuntimeSpecification.cs index 9bf11da62..4b89577fc 100644 --- a/src/NzbDrone.Core/AutoTagging/Specifications/RuntimeSpecification.cs +++ b/src/NzbDrone.Core/AutoTagging/Specifications/RuntimeSpecification.cs @@ -24,10 +24,10 @@ namespace NzbDrone.Core.AutoTagging.Specifications public override int Order => 1; public override string ImplementationName => "Runtime"; - [FieldDefinition(1, Label = "Minimum Runtime", Type = FieldType.Number)] + [FieldDefinition(1, Label = "AutoTaggingSpecificationMinimumRuntime", Type = FieldType.Number, Unit = "minutes")] public int Min { get; set; } - [FieldDefinition(2, Label = "Maximum Runtime", Type = FieldType.Number)] + [FieldDefinition(2, Label = "AutoTaggingSpecificationMaximumRuntime", Type = FieldType.Number, Unit = "minutes")] public int Max { get; set; } protected override bool IsSatisfiedByWithoutNegate(Movie movie) diff --git a/src/NzbDrone.Core/AutoTagging/Specifications/YearSpecification.cs b/src/NzbDrone.Core/AutoTagging/Specifications/YearSpecification.cs index 966af681b..b6b57187c 100644 --- a/src/NzbDrone.Core/AutoTagging/Specifications/YearSpecification.cs +++ b/src/NzbDrone.Core/AutoTagging/Specifications/YearSpecification.cs @@ -23,10 +23,10 @@ namespace NzbDrone.Core.AutoTagging.Specifications public override int Order => 1; public override string ImplementationName => "Year"; - [FieldDefinition(1, Label = "Minimum Year", Type = FieldType.Number)] + [FieldDefinition(1, Label = "AutoTaggingSpecificationMinimumYear", Type = FieldType.Number)] public int Min { get; set; } - [FieldDefinition(2, Label = "Maximum Year", Type = FieldType.Number)] + [FieldDefinition(2, Label = "AutoTaggingSpecificationMaximumYear", Type = FieldType.Number)] public int Max { get; set; } protected override bool IsSatisfiedByWithoutNegate(Movie movie) diff --git a/src/NzbDrone.Core/CustomFormats/Specifications/LanguageSpecification.cs b/src/NzbDrone.Core/CustomFormats/Specifications/LanguageSpecification.cs index 516c8196c..49a6dff46 100644 --- a/src/NzbDrone.Core/CustomFormats/Specifications/LanguageSpecification.cs +++ b/src/NzbDrone.Core/CustomFormats/Specifications/LanguageSpecification.cs @@ -27,7 +27,7 @@ namespace NzbDrone.Core.CustomFormats public override int Order => 3; public override string ImplementationName => "Language"; - [FieldDefinition(1, Label = "Language", Type = FieldType.Select, SelectOptions = typeof(LanguageFieldConverter))] + [FieldDefinition(1, Label = "CustomFormatsSpecificationLanguage", Type = FieldType.Select, SelectOptions = typeof(LanguageFieldConverter))] public int Value { get; set; } [FieldDefinition(1, Label = "CustomFormatsSpecificationExceptLanguage", HelpText = "CustomFormatsSpecificationExceptLanguageHelpText", Type = FieldType.Checkbox)] diff --git a/src/NzbDrone.Core/CustomFormats/Specifications/QualityModifierSpecification.cs b/src/NzbDrone.Core/CustomFormats/Specifications/QualityModifierSpecification.cs index 3be30fe41..d5a1cf787 100644 --- a/src/NzbDrone.Core/CustomFormats/Specifications/QualityModifierSpecification.cs +++ b/src/NzbDrone.Core/CustomFormats/Specifications/QualityModifierSpecification.cs @@ -28,7 +28,7 @@ namespace NzbDrone.Core.CustomFormats public override int Order => 7; public override string ImplementationName => "Quality Modifier"; - [FieldDefinition(1, Label = "Quality Modifier", Type = FieldType.Select, SelectOptions = typeof(Modifier))] + [FieldDefinition(1, Label = "CustomFormatsSpecificationQualityModifier", Type = FieldType.Select, SelectOptions = typeof(Modifier))] public int Value { get; set; } protected override bool IsSatisfiedByWithoutNegate(CustomFormatInput input) diff --git a/src/NzbDrone.Core/CustomFormats/Specifications/ResolutionSpecification.cs b/src/NzbDrone.Core/CustomFormats/Specifications/ResolutionSpecification.cs index 6889605a4..a7866d0a0 100644 --- a/src/NzbDrone.Core/CustomFormats/Specifications/ResolutionSpecification.cs +++ b/src/NzbDrone.Core/CustomFormats/Specifications/ResolutionSpecification.cs @@ -20,7 +20,7 @@ namespace NzbDrone.Core.CustomFormats public override int Order => 6; public override string ImplementationName => "Resolution"; - [FieldDefinition(1, Label = "Resolution", Type = FieldType.Select, SelectOptions = typeof(Resolution))] + [FieldDefinition(1, Label = "CustomFormatsSpecificationResolution", Type = FieldType.Select, SelectOptions = typeof(Resolution))] public int Value { get; set; } protected override bool IsSatisfiedByWithoutNegate(CustomFormatInput input) diff --git a/src/NzbDrone.Core/CustomFormats/Specifications/SizeSpecification.cs b/src/NzbDrone.Core/CustomFormats/Specifications/SizeSpecification.cs index fe873f9ec..039d446e7 100644 --- a/src/NzbDrone.Core/CustomFormats/Specifications/SizeSpecification.cs +++ b/src/NzbDrone.Core/CustomFormats/Specifications/SizeSpecification.cs @@ -21,10 +21,10 @@ namespace NzbDrone.Core.CustomFormats public override int Order => 8; public override string ImplementationName => "Size"; - [FieldDefinition(1, Label = "Minimum Size", HelpText = "Release must be greater than this size", Unit = "GB", Type = FieldType.Number)] + [FieldDefinition(1, Label = "CustomFormatsSpecificationMinimumSize", HelpText = "CustomFormatsSpecificationMinimumSizeHelpText", Unit = "GB", Type = FieldType.Number)] public double Min { get; set; } - [FieldDefinition(1, Label = "Maximum Size", HelpText = "Release must be less than or equal to this size", Unit = "GB", Type = FieldType.Number)] + [FieldDefinition(1, Label = "CustomFormatsSpecificationMaximumSize", HelpText = "CustomFormatsSpecificationMaximumSizeHelpText", Unit = "GB", Type = FieldType.Number)] public double Max { get; set; } protected override bool IsSatisfiedByWithoutNegate(CustomFormatInput input) diff --git a/src/NzbDrone.Core/CustomFormats/Specifications/SourceSpecification.cs b/src/NzbDrone.Core/CustomFormats/Specifications/SourceSpecification.cs index e150318ea..b5d356699 100644 --- a/src/NzbDrone.Core/CustomFormats/Specifications/SourceSpecification.cs +++ b/src/NzbDrone.Core/CustomFormats/Specifications/SourceSpecification.cs @@ -20,7 +20,7 @@ namespace NzbDrone.Core.CustomFormats public override int Order => 5; public override string ImplementationName => "Source"; - [FieldDefinition(1, Label = "Source", Type = FieldType.Select, SelectOptions = typeof(QualitySource))] + [FieldDefinition(1, Label = "CustomFormatsSpecificationSource", Type = FieldType.Select, SelectOptions = typeof(QualitySource))] public int Value { get; set; } protected override bool IsSatisfiedByWithoutNegate(CustomFormatInput input) diff --git a/src/NzbDrone.Core/CustomFormats/Specifications/YearSpecification.cs b/src/NzbDrone.Core/CustomFormats/Specifications/YearSpecification.cs index 87bf7ba27..1a146936a 100644 --- a/src/NzbDrone.Core/CustomFormats/Specifications/YearSpecification.cs +++ b/src/NzbDrone.Core/CustomFormats/Specifications/YearSpecification.cs @@ -20,10 +20,10 @@ namespace NzbDrone.Core.CustomFormats public override int Order => 10; public override string ImplementationName => "Year"; - [FieldDefinition(1, Label = "Minimum Year", Type = FieldType.Number)] + [FieldDefinition(1, Label = "CustomFormatsSpecificationMinimumYear", Type = FieldType.Number)] public int Min { get; set; } - [FieldDefinition(2, Label = "Maximum Year", Type = FieldType.Number)] + [FieldDefinition(2, Label = "CustomFormatsSpecificationMaximumYear", Type = FieldType.Number)] public int Max { get; set; } protected override bool IsSatisfiedByWithoutNegate(CustomFormatInput input) diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index cff52025f..a86df4f69 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -116,6 +116,14 @@ "AutoTaggingLoadError": "Unable to load auto tagging", "AutoTaggingNegateHelpText": "If checked, the auto tagging rule will not apply if this {implementationName} condition matches.", "AutoTaggingRequiredHelpText": "This {implementationName} condition must match for the auto tagging rule to apply. Otherwise a single {implementationName} match is sufficient.", + "AutoTaggingSpecificationGenre": "Genre(s)", + "AutoTaggingSpecificationMaximumRuntime": "Maximum Runtime", + "AutoTaggingSpecificationMaximumYear": "Maximum Year", + "AutoTaggingSpecificationMinimumRuntime": "Minimum Runtime", + "AutoTaggingSpecificationMinimumYear": "Minimum Year", + "AutoTaggingSpecificationOriginalLanguage": "Language", + "AutoTaggingSpecificationQualityProfile": "Quality Profile", + "AutoTaggingSpecificationRootFolder": "Root Folder", "AutoTaggingSpecificationTag": "Tag", "AutoUnmonitorPreviouslyDownloadedMoviesHelpText": "Movies deleted from the disk are automatically unmonitored in {appName}", "Automatic": "Automatic", @@ -270,8 +278,18 @@ "CustomFormatsSpecificationExceptLanguage": "Except Language", "CustomFormatsSpecificationExceptLanguageHelpText": "Matches if any language other than the selected language is present", "CustomFormatsSpecificationFlag": "Flag", + "CustomFormatsSpecificationLanguage": "Language", + "CustomFormatsSpecificationMaximumSize": "Maximum Size", + "CustomFormatsSpecificationMaximumSizeHelpText": "Release must be less than or equal to this size", + "CustomFormatsSpecificationMaximumYear": "Maximum Year", + "CustomFormatsSpecificationMinimumSize": "Minimum Size", + "CustomFormatsSpecificationMinimumSizeHelpText": "Release must be greater than this size", + "CustomFormatsSpecificationMinimumYear": "Minimum Year", + "CustomFormatsSpecificationQualityModifier": "Quality Modifier", "CustomFormatsSpecificationRegularExpression": "Regular Expression", "CustomFormatsSpecificationRegularExpressionHelpText": "Custom Format RegEx is Case Insensitive", + "CustomFormatsSpecificationResolution": "Resolution", + "CustomFormatsSpecificationSource": "Source", "Cutoff": "Cutoff", "CutoffNotMet": "Cutoff Not Met", "CutoffUnmet": "Cutoff Unmet", diff --git a/src/Radarr.Http/ClientSchema/SchemaBuilder.cs b/src/Radarr.Http/ClientSchema/SchemaBuilder.cs index 2be274338..88838a2b5 100644 --- a/src/Radarr.Http/ClientSchema/SchemaBuilder.cs +++ b/src/Radarr.Http/ClientSchema/SchemaBuilder.cs @@ -228,10 +228,15 @@ namespace Radarr.Http.ClientSchema if (attrib != null) { + var label = attrib.Label.IsNotNullOrWhiteSpace() + ? _localizationService.GetLocalizedString(attrib.Label, + GetTokens(selectOptions, attrib.Label, TokenField.Label)) + : attrib.Label; + return new SelectOption { Value = value, - Name = attrib.Label ?? name, + Name = label ?? name, Order = attrib.Order, Hint = attrib.Hint ?? $"({value})" };