From 25b15c9c3368026554fe4ccfd00f9e629c81de90 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Mon, 28 Nov 2022 10:22:27 +0000 Subject: [PATCH] Move all localizable strings from Aaru.Helpers project to resources. --- Aaru.Helpers.csproj | 9 ++++ Aaru.Helpers.csproj.DotSettings | 2 + ArrayFill.cs | 2 +- Localization/Localization.Designer.cs | 60 +++++++++++++++++++++++++++ Localization/Localization.resx | 30 ++++++++++++++ PrintHex.cs | 2 +- 6 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 Aaru.Helpers.csproj.DotSettings create mode 100644 Localization/Localization.Designer.cs create mode 100644 Localization/Localization.resx diff --git a/Aaru.Helpers.csproj b/Aaru.Helpers.csproj index 914137b..46080df 100644 --- a/Aaru.Helpers.csproj +++ b/Aaru.Helpers.csproj @@ -48,6 +48,11 @@ + + True + True + Localization.resx + @@ -65,6 +70,10 @@ LICENSE.LGPL + + ResXFileCodeGenerator + Localization.Designer.cs + diff --git a/Aaru.Helpers.csproj.DotSettings b/Aaru.Helpers.csproj.DotSettings new file mode 100644 index 0000000..dc0dbdc --- /dev/null +++ b/Aaru.Helpers.csproj.DotSettings @@ -0,0 +1,2 @@ + + True \ No newline at end of file diff --git a/ArrayFill.cs b/ArrayFill.cs index c3e9e1b..bda93c7 100644 --- a/ArrayFill.cs +++ b/ArrayFill.cs @@ -49,7 +49,7 @@ public static partial class ArrayHelpers ArgumentNullException.ThrowIfNull(destinationArray); if(value.Length > destinationArray.Length) - throw new ArgumentException("Length of value array must not be more than length of destination"); + throw new ArgumentException(Localization.Length_of_value_array_must_not_be_more_than_length_of_destination); // set the initial array value Array.Copy(value, destinationArray, value.Length); diff --git a/Localization/Localization.Designer.cs b/Localization/Localization.Designer.cs new file mode 100644 index 0000000..4080069 --- /dev/null +++ b/Localization/Localization.Designer.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Aaru.Helpers { + using System; + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Localization { + + private static System.Resources.ResourceManager resourceMan; + + private static System.Globalization.CultureInfo resourceCulture; + + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Localization() { + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Resources.ResourceManager ResourceManager { + get { + if (object.Equals(null, resourceMan)) { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Aaru.Helpers.Localization.Localization", typeof(Localization).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + internal static string Length_of_value_array_must_not_be_more_than_length_of_destination { + get { + return ResourceManager.GetString("Length_of_value_array_must_not_be_more_than_length_of_destination", resourceCulture); + } + } + + internal static string Offset { + get { + return ResourceManager.GetString("Offset", resourceCulture); + } + } + } +} diff --git a/Localization/Localization.resx b/Localization/Localization.resx new file mode 100644 index 0000000..bc6fe31 --- /dev/null +++ b/Localization/Localization.resx @@ -0,0 +1,30 @@ + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + Length of value array must not be more than length of destination + + + Offset + + \ No newline at end of file diff --git a/PrintHex.cs b/PrintHex.cs index 448b342..cc56d25 100644 --- a/PrintHex.cs +++ b/PrintHex.cs @@ -56,7 +56,7 @@ public static class PrintHex // TODO: Color list // TODO: Allow to change width - string str = "Offset"; + string str = Localization.Offset; int rows = array.Length / width; int last = array.Length % width; int offsetLength = $"{array.Length:X}".Length;