From 037413e05de29c1f3d7d01147261dae19b85e472 Mon Sep 17 00:00:00 2001 From: indigo-san Date: Thu, 17 Aug 2023 01:56:23 +0900 Subject: [PATCH] localize --- .../Graphics/FilterEffects/Brightness.cs | 3 + .../Graphics/FilterEffects/Clipping.cs | 7 +- .../Graphics/FilterEffects/Dilate.cs | 8 +- .../Graphics/FilterEffects/Erode.cs | 8 +- .../Graphics/FilterEffects/Gamma.cs | 4 + .../Graphics/FilterEffects/HighContrast.cs | 9 +- .../Graphics/FilterEffects/HueRotate.cs | 7 +- .../Graphics/FilterEffects/Invert.cs | 3 + .../Graphics/FilterEffects/Lighting.cs | 7 +- .../Graphics/FilterEffects/LutEffect.cs | 2 + .../Graphics/FilterEffects/Saturate.cs | 7 +- .../Graphics/FilterEffects/Threshold.cs | 4 + .../Graphics/FilterEffects/TransformEffect.cs | 9 +- src/Beutl.Language/LocalizeService.cs | 8 +- src/Beutl.Language/Strings.Designer.cs | 144 ++++++++++++++++++ src/Beutl.Language/Strings.ja.resx | 48 ++++++ src/Beutl.Language/Strings.resx | 48 ++++++ src/Beutl.Operators/LibraryRegistrar.cs | 16 +- 18 files changed, 318 insertions(+), 24 deletions(-) diff --git a/src/Beutl.Engine/Graphics/FilterEffects/Brightness.cs b/src/Beutl.Engine/Graphics/FilterEffects/Brightness.cs index b8bd94bb7..cf872e0f1 100644 --- a/src/Beutl.Engine/Graphics/FilterEffects/Brightness.cs +++ b/src/Beutl.Engine/Graphics/FilterEffects/Brightness.cs @@ -1,5 +1,7 @@ using System.ComponentModel.DataAnnotations; +using Beutl.Language; + namespace Beutl.Graphics.Effects; public sealed class Brightness : FilterEffect @@ -17,6 +19,7 @@ static Brightness() AffectsRender(AmountProperty); } + [Display(Name = nameof(Strings.Amount), ResourceType = typeof(Strings))] [Range(0, float.MaxValue)] public float Amount { diff --git a/src/Beutl.Engine/Graphics/FilterEffects/Clipping.cs b/src/Beutl.Engine/Graphics/FilterEffects/Clipping.cs index 3328b8480..70122205f 100644 --- a/src/Beutl.Engine/Graphics/FilterEffects/Clipping.cs +++ b/src/Beutl.Engine/Graphics/FilterEffects/Clipping.cs @@ -1,4 +1,8 @@ -using SkiaSharp; +using System.ComponentModel.DataAnnotations; + +using Beutl.Language; + +using SkiaSharp; namespace Beutl.Graphics.Effects; @@ -16,6 +20,7 @@ static Clipping() AffectsRender(ThicknessProperty); } + [Display(Name = nameof(Strings.Thickness), ResourceType = typeof(Strings))] public Thickness Thickness { get => _thickness; diff --git a/src/Beutl.Engine/Graphics/FilterEffects/Dilate.cs b/src/Beutl.Engine/Graphics/FilterEffects/Dilate.cs index 128824fe8..8c8401f21 100644 --- a/src/Beutl.Engine/Graphics/FilterEffects/Dilate.cs +++ b/src/Beutl.Engine/Graphics/FilterEffects/Dilate.cs @@ -1,4 +1,8 @@ -namespace Beutl.Graphics.Effects; +using System.ComponentModel.DataAnnotations; + +using Beutl.Language; + +namespace Beutl.Graphics.Effects; public sealed class Dilate : FilterEffect { @@ -20,12 +24,14 @@ static Dilate() AffectsRender(RadiusXProperty, RadiusYProperty); } + [Display(Name = nameof(Strings.RadiusX), ResourceType = typeof(Strings))] public float RadiusX { get => _radiusX; set => SetAndRaise(RadiusXProperty, ref _radiusX, value); } + [Display(Name = nameof(Strings.RadiusY), ResourceType = typeof(Strings))] public float RadiusY { get => _radiusY; diff --git a/src/Beutl.Engine/Graphics/FilterEffects/Erode.cs b/src/Beutl.Engine/Graphics/FilterEffects/Erode.cs index bb83cb3e5..ad50b0b8e 100644 --- a/src/Beutl.Engine/Graphics/FilterEffects/Erode.cs +++ b/src/Beutl.Engine/Graphics/FilterEffects/Erode.cs @@ -1,4 +1,8 @@ -namespace Beutl.Graphics.Effects; +using System.ComponentModel.DataAnnotations; + +using Beutl.Language; + +namespace Beutl.Graphics.Effects; public sealed class Erode : FilterEffect { @@ -20,12 +24,14 @@ static Erode() AffectsRender(RadiusXProperty, RadiusYProperty); } + [Display(Name = nameof(Strings.RadiusX), ResourceType = typeof(Strings))] public float RadiusX { get => _radiusX; set => SetAndRaise(RadiusXProperty, ref _radiusX, value); } + [Display(Name = nameof(Strings.RadiusY), ResourceType = typeof(Strings))] public float RadiusY { get => _radiusY; diff --git a/src/Beutl.Engine/Graphics/FilterEffects/Gamma.cs b/src/Beutl.Engine/Graphics/FilterEffects/Gamma.cs index 44b0f4b52..1a187662a 100644 --- a/src/Beutl.Engine/Graphics/FilterEffects/Gamma.cs +++ b/src/Beutl.Engine/Graphics/FilterEffects/Gamma.cs @@ -1,5 +1,7 @@ using System.ComponentModel.DataAnnotations; +using Beutl.Language; + namespace Beutl.Graphics.Effects; public sealed class Gamma : FilterEffect @@ -24,6 +26,7 @@ static Gamma() AffectsRender(AmountProperty, StrengthProperty); } + [Display(Name = nameof(Strings.Amount), ResourceType = typeof(Strings))] [Range(1, 300)] public float Amount { @@ -31,6 +34,7 @@ public float Amount set => SetAndRaise(AmountProperty, ref _amount, value); } + [Display(Name = nameof(Strings.Strength), ResourceType = typeof(Strings))] [Range(0, 100)] public float Strength { diff --git a/src/Beutl.Engine/Graphics/FilterEffects/HighContrast.cs b/src/Beutl.Engine/Graphics/FilterEffects/HighContrast.cs index cf21cfb83..28ff4efa7 100644 --- a/src/Beutl.Engine/Graphics/FilterEffects/HighContrast.cs +++ b/src/Beutl.Engine/Graphics/FilterEffects/HighContrast.cs @@ -1,4 +1,8 @@ -namespace Beutl.Graphics.Effects; +using System.ComponentModel.DataAnnotations; + +using Beutl.Language; + +namespace Beutl.Graphics.Effects; public sealed class HighContrast : FilterEffect { @@ -26,18 +30,21 @@ static HighContrast() AffectsRender(GrayscaleProperty, InvertStyleProperty, ContrastProperty); } + [Display(Name = nameof(Strings.Grayscale), ResourceType = typeof(Strings))] public bool Grayscale { get => _grayscale; set => SetAndRaise(GrayscaleProperty, ref _grayscale, value); } + [Display(Name = nameof(Strings.InvertStyle), ResourceType = typeof(Strings))] public HighContrastInvertStyle InvertStyle { get => _invertStyle; set => SetAndRaise(InvertStyleProperty, ref _invertStyle, value); } + [Display(Name = nameof(Strings.Contrast), ResourceType = typeof(Strings))] public float Contrast { get => _contrast; diff --git a/src/Beutl.Engine/Graphics/FilterEffects/HueRotate.cs b/src/Beutl.Engine/Graphics/FilterEffects/HueRotate.cs index d83f43cb1..8f5991034 100644 --- a/src/Beutl.Engine/Graphics/FilterEffects/HueRotate.cs +++ b/src/Beutl.Engine/Graphics/FilterEffects/HueRotate.cs @@ -1,4 +1,8 @@ -namespace Beutl.Graphics.Effects; +using System.ComponentModel.DataAnnotations; + +using Beutl.Language; + +namespace Beutl.Graphics.Effects; public sealed class HueRotate : FilterEffect { @@ -14,6 +18,7 @@ static HueRotate() AffectsRender(AngleProperty); } + [Display(Name = nameof(Strings.Angle), ResourceType = typeof(Strings))] public float Angle { get => _angle; diff --git a/src/Beutl.Engine/Graphics/FilterEffects/Invert.cs b/src/Beutl.Engine/Graphics/FilterEffects/Invert.cs index fd6d181bd..3732e9b16 100644 --- a/src/Beutl.Engine/Graphics/FilterEffects/Invert.cs +++ b/src/Beutl.Engine/Graphics/FilterEffects/Invert.cs @@ -1,6 +1,8 @@ using System.ComponentModel.DataAnnotations; using System.Reactive; +using Beutl.Language; + namespace Beutl.Graphics.Effects; public sealed class Invert : FilterEffect @@ -19,6 +21,7 @@ static Invert() } [Range(0, 100)] + [Display(Name = nameof(Strings.Amount), ResourceType = typeof(Strings))] public float Amount { get => _amount; diff --git a/src/Beutl.Engine/Graphics/FilterEffects/Lighting.cs b/src/Beutl.Engine/Graphics/FilterEffects/Lighting.cs index e03372644..ea3a2b13d 100644 --- a/src/Beutl.Engine/Graphics/FilterEffects/Lighting.cs +++ b/src/Beutl.Engine/Graphics/FilterEffects/Lighting.cs @@ -1,4 +1,7 @@ -using Beutl.Media; +using System.ComponentModel.DataAnnotations; + +using Beutl.Language; +using Beutl.Media; namespace Beutl.Graphics.Effects; @@ -23,12 +26,14 @@ static Lighting() AffectsRender(MultiplyProperty, AddProperty); } + [Display(Name = nameof(Strings.Multiplication), ResourceType = typeof(Strings))] public Color Multiply { get => _multiply; set => SetAndRaise(MultiplyProperty, ref _multiply, value); } + [Display(Name = nameof(Strings.Addition), ResourceType = typeof(Strings))] public Color Add { get => _add; diff --git a/src/Beutl.Engine/Graphics/FilterEffects/LutEffect.cs b/src/Beutl.Engine/Graphics/FilterEffects/LutEffect.cs index d6cb94228..6e4c7c36f 100644 --- a/src/Beutl.Engine/Graphics/FilterEffects/LutEffect.cs +++ b/src/Beutl.Engine/Graphics/FilterEffects/LutEffect.cs @@ -3,6 +3,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using Beutl.Language; using Beutl.Media; using Beutl.Rendering; @@ -69,6 +70,7 @@ private void OnSourceChanged(FileInfo? value) } } + [Display(Name = nameof(Strings.Strength), ResourceType = typeof(Strings))] [Range(0, 100)] public float Strength { diff --git a/src/Beutl.Engine/Graphics/FilterEffects/Saturate.cs b/src/Beutl.Engine/Graphics/FilterEffects/Saturate.cs index 070515f8d..fbc49816d 100644 --- a/src/Beutl.Engine/Graphics/FilterEffects/Saturate.cs +++ b/src/Beutl.Engine/Graphics/FilterEffects/Saturate.cs @@ -1,4 +1,8 @@ -namespace Beutl.Graphics.Effects; +using System.ComponentModel.DataAnnotations; + +using Beutl.Language; + +namespace Beutl.Graphics.Effects; public sealed class Saturate : FilterEffect { @@ -15,6 +19,7 @@ static Saturate() AffectsRender(AmountProperty); } + [Display(Name = nameof(Strings.Amount), ResourceType = typeof(Strings))] public float Amount { get => _amount; diff --git a/src/Beutl.Engine/Graphics/FilterEffects/Threshold.cs b/src/Beutl.Engine/Graphics/FilterEffects/Threshold.cs index ded31c4b4..96927529d 100644 --- a/src/Beutl.Engine/Graphics/FilterEffects/Threshold.cs +++ b/src/Beutl.Engine/Graphics/FilterEffects/Threshold.cs @@ -1,5 +1,7 @@ using System.ComponentModel.DataAnnotations; +using Beutl.Language; + using SkiaSharp; namespace Beutl.Graphics.Effects; @@ -26,6 +28,7 @@ static Threshold() AffectsRender(ValueProperty, StrengthProperty); } + [Display(Name = nameof(Strings.Amount), ResourceType = typeof(Strings))] [Range(0, 100)] public float Value { @@ -33,6 +36,7 @@ public float Value set => SetAndRaise(ValueProperty, ref _value, value); } + [Display(Name = nameof(Strings.Strength), ResourceType = typeof(Strings))] [Range(0, 100)] public float Strength { diff --git a/src/Beutl.Engine/Graphics/FilterEffects/TransformEffect.cs b/src/Beutl.Engine/Graphics/FilterEffects/TransformEffect.cs index 34b1c3a48..d89c7ba75 100644 --- a/src/Beutl.Engine/Graphics/FilterEffects/TransformEffect.cs +++ b/src/Beutl.Engine/Graphics/FilterEffects/TransformEffect.cs @@ -1,5 +1,8 @@ -using Beutl.Animation; +using System.ComponentModel.DataAnnotations; + +using Beutl.Animation; using Beutl.Graphics.Transformation; +using Beutl.Language; using Beutl.Media; namespace Beutl.Graphics.Effects; @@ -20,18 +23,20 @@ static TransformEffect() BitmapInterpolationModeProperty = ConfigureProperty(nameof(BitmapInterpolationMode)) .Accessor(o => o.BitmapInterpolationMode, (o, v) => o.BitmapInterpolationMode = v) - .DefaultValue(Media.BitmapInterpolationMode.Default) + .DefaultValue(BitmapInterpolationMode.Default) .Register(); AffectsRender(TransformProperty, BitmapInterpolationModeProperty); } + [Display(Name = nameof(Strings.Transform), ResourceType = typeof(Strings))] public ITransform? Transform { get => _transform; set => SetAndRaise(TransformProperty, ref _transform, value); } + [Display(Name = nameof(Strings.BitmapInterpolationMode), ResourceType = typeof(Strings))] public BitmapInterpolationMode BitmapInterpolationMode { get => _interpolationMode; diff --git a/src/Beutl.Language/LocalizeService.cs b/src/Beutl.Language/LocalizeService.cs index 48c569463..b64984116 100644 --- a/src/Beutl.Language/LocalizeService.cs +++ b/src/Beutl.Language/LocalizeService.cs @@ -16,14 +16,8 @@ public bool IsSupportedCulture(CultureInfo ci) return _supported.Contains(ci.Name); } - public Uri GetUri(CultureInfo ci) - { - if (!IsSupportedCulture(ci)) throw new InvalidOperationException(); - return new Uri($"avares://Beutl.Language/{ci.Name}/CommonResources.axaml"); - } - public IEnumerable SupportedCultures() { - return _supported.Select(n => CultureInfo.GetCultureInfo(n)); + return _supported.Select(CultureInfo.GetCultureInfo); } } diff --git a/src/Beutl.Language/Strings.Designer.cs b/src/Beutl.Language/Strings.Designer.cs index 2374d83a3..b1c127839 100644 --- a/src/Beutl.Language/Strings.Designer.cs +++ b/src/Beutl.Language/Strings.Designer.cs @@ -87,6 +87,15 @@ public static string AddElement { } } + /// + /// Addition に類似しているローカライズされた文字列を検索します。 + /// + public static string Addition { + get { + return ResourceManager.GetString("Addition", resourceCulture); + } + } + /// /// Additional Options に類似しているローカライズされた文字列を検索します。 /// @@ -159,6 +168,15 @@ public static string All { } } + /// + /// Amount に類似しているローカライズされた文字列を検索します。 + /// + public static string Amount { + get { + return ResourceManager.GetString("Amount", resourceCulture); + } + } + /// /// Angle に類似しているローカライズされた文字列を検索します。 /// @@ -285,6 +303,15 @@ public static string Bottom { } } + /// + /// Brightness に類似しているローカライズされた文字列を検索します。 + /// + public static string Brightness { + get { + return ResourceManager.GetString("Brightness", resourceCulture); + } + } + /// /// Bring to the top に類似しているローカライズされた文字列を検索します。 /// @@ -402,6 +429,15 @@ public static string ContentType { } } + /// + /// Contrast に類似しているローカライズされた文字列を検索します。 + /// + public static string Contrast { + get { + return ResourceManager.GetString("Contrast", resourceCulture); + } + } + /// /// Copy に類似しているローカライズされた文字列を検索します。 /// @@ -835,6 +871,15 @@ public static string Fill { } } + /// + /// Filter Effect に類似しているローカライズされた文字列を検索します。 + /// + public static string FilterEffect { + get { + return ResourceManager.GetString("FilterEffect", resourceCulture); + } + } + /// /// Finish editing に類似しているローカライズされた文字列を検索します。 /// @@ -952,6 +997,15 @@ public static string FrameSize_Tip { } } + /// + /// Gamma に類似しているローカライズされた文字列を検索します。 + /// + public static string Gamma { + get { + return ResourceManager.GetString("Gamma", resourceCulture); + } + } + /// /// Gradient Origin に類似しているローカライズされた文字列を検索します。 /// @@ -979,6 +1033,15 @@ public static string GraphEditor { } } + /// + /// Grayscale に類似しているローカライズされた文字列を検索します。 + /// + public static string Grayscale { + get { + return ResourceManager.GetString("Grayscale", resourceCulture); + } + } + /// /// Group に類似しているローカライズされた文字列を検索します。 /// @@ -1024,6 +1087,15 @@ public static string HueRotate { } } + /// + /// Image に類似しているローカライズされた文字列を検索します。 + /// + public static string Image { + get { + return ResourceManager.GetString("Image", resourceCulture); + } + } + /// /// Image File に類似しているローカライズされた文字列を検索します。 /// @@ -1078,6 +1150,24 @@ public static string InvalidJson { } } + /// + /// Invert に類似しているローカライズされた文字列を検索します。 + /// + public static string Invert { + get { + return ResourceManager.GetString("Invert", resourceCulture); + } + } + + /// + /// Invert Style に類似しているローカライズされた文字列を検索します。 + /// + public static string InvertStyle { + get { + return ResourceManager.GetString("InvertStyle", resourceCulture); + } + } + /// /// {0} is not a valid. に類似しているローカライズされた文字列を検索します。 /// @@ -1204,6 +1294,15 @@ public static string LumaColor { } } + /// + /// LUT (Cube File) に類似しているローカライズされた文字列を検索します。 + /// + public static string LUT_Cube_File { + get { + return ResourceManager.GetString("LUT_Cube_File", resourceCulture); + } + } + /// /// Margin に類似しているローカライズされた文字列を検索します。 /// @@ -1249,6 +1348,15 @@ public static string MoveOneFront { } } + /// + /// Multiplication に類似しているローカライズされた文字列を検索します。 + /// + public static string Multiplication { + get { + return ResourceManager.GetString("Multiplication", resourceCulture); + } + } + /// /// Name に類似しているローカライズされた文字列を検索します。 /// @@ -1546,6 +1654,24 @@ public static string Radius { } } + /// + /// Radius X に類似しているローカライズされた文字列を検索します。 + /// + public static string RadiusX { + get { + return ResourceManager.GetString("RadiusX", resourceCulture); + } + } + + /// + /// Radius Y に類似しているローカライズされた文字列を検索します。 + /// + public static string RadiusY { + get { + return ResourceManager.GetString("RadiusY", resourceCulture); + } + } + /// /// Recent Files に類似しているローカライズされた文字列を検索します。 /// @@ -1861,6 +1987,15 @@ public static string Skew { } } + /// + /// Sound に類似しているローカライズされた文字列を検索します。 + /// + public static string Sound { + get { + return ResourceManager.GetString("Sound", resourceCulture); + } + } + /// /// Source に類似しているローカライズされた文字列を検索します。 /// @@ -1960,6 +2095,15 @@ public static string Stereo { } } + /// + /// Strength に類似しているローカライズされた文字列を検索します。 + /// + public static string Strength { + get { + return ResourceManager.GetString("Strength", resourceCulture); + } + } + /// /// Stretch に類似しているローカライズされた文字列を検索します。 /// diff --git a/src/Beutl.Language/Strings.ja.resx b/src/Beutl.Language/Strings.ja.resx index 539a1b407..9b914c66b 100644 --- a/src/Beutl.Language/Strings.ja.resx +++ b/src/Beutl.Language/Strings.ja.resx @@ -826,4 +826,52 @@ b-editorがダウンロードURLを管理します。 完了しました + + 画像 + + + サウンド + + + フィルタエフェクト + + + 明るさ + + + ガンマ + + + 反転 + + + LUT (Cubeファイル) + + + + + + 半径X + + + 半径Y + + + 強さ + + + グレースケール + + + 反転モード + + + コントラスト + + + 加算 + + + 乗算 + \ No newline at end of file diff --git a/src/Beutl.Language/Strings.resx b/src/Beutl.Language/Strings.resx index 48249bbac..7884524f8 100644 --- a/src/Beutl.Language/Strings.resx +++ b/src/Beutl.Language/Strings.resx @@ -826,4 +826,52 @@ and b-editor maintains the download URL. Completed + + Image + + + Sound + + + Filter Effect + + + Brightness + + + Gamma + + + Invert + + + LUT (Cube File) + + + Amount + + + Radius X + + + Radius Y + + + Strength + + + Grayscale + + + Invert Style + + + Contrast + + + Addition + + + Multiplication + \ No newline at end of file diff --git a/src/Beutl.Operators/LibraryRegistrar.cs b/src/Beutl.Operators/LibraryRegistrar.cs index 20b40cd1a..2d0149d53 100644 --- a/src/Beutl.Operators/LibraryRegistrar.cs +++ b/src/Beutl.Operators/LibraryRegistrar.cs @@ -114,19 +114,19 @@ public static void RegisterAll() ); LibraryService.Current - .AddMultiple("SourceVideo", m => m + .AddMultiple(Strings.Video, m => m .BindSourceOperator() .BindDrawable() ); LibraryService.Current - .AddMultiple("SourceImage", m => m + .AddMultiple(Strings.Image, m => m .BindSourceOperator() .BindDrawable() ); LibraryService.Current - .AddMultiple("SourceSound", m => m + .AddMultiple(Strings.Sound, m => m .BindSourceOperator() .BindSound() ); @@ -165,7 +165,7 @@ public static void RegisterAll() ); LibraryService.Current - .RegisterGroup(Strings.ImageFilter, g => g + .RegisterGroup(Strings.FilterEffect, g => g .AddMultiple(Strings.Blur, m => m .BindSourceOperator() .BindFilterEffect() @@ -231,22 +231,22 @@ public static void RegisterAll() .BindFilterEffect() ) - .AddMultiple("Brightness", m => m + .AddMultiple(Strings.Brightness, m => m .BindSourceOperator() .BindFilterEffect() ) - .AddMultiple("Gamma", m => m + .AddMultiple(Strings.Gamma, m => m .BindSourceOperator() .BindFilterEffect() ) - .AddMultiple("Invert", m => m + .AddMultiple(Strings.Invert, m => m .BindSourceOperator() .BindFilterEffect() ) - .AddMultiple("LUT (Cube File)", m => m + .AddMultiple(Strings.LUT_Cube_File, m => m .BindSourceOperator() .BindFilterEffect() )