Move all localizable strings from Aaru.Helpers project to resources.

This commit is contained in:
2022-11-28 10:22:27 +00:00
parent cfe81b8905
commit 25b15c9c33
6 changed files with 103 additions and 2 deletions

View File

@@ -48,6 +48,11 @@
<Compile Include="BitEndian.cs"/>
<Compile Include="DateHandlers.cs"/>
<Compile Include="Extensions.cs"/>
<Compile Include="Localization\Localization.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Localization.resx</DependentUpon>
</Compile>
<Compile Include="Marshal.cs"/>
<Compile Include="MarshallingPropertiesAttribute.cs"/>
<Compile Include="PrintHex.cs"/>
@@ -65,6 +70,10 @@
<EmbeddedResource Include="..\LICENSE.LGPL">
<Link>LICENSE.LGPL</Link>
</EmbeddedResource>
<EmbeddedResource Update="Localization\Localization.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Localization.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Memory" Version="4.5.5"/>

View File

@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=localization/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -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);

60
Localization/Localization.Designer.cs generated Normal file
View File

@@ -0,0 +1,60 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
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);
}
}
}
}

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"
xmlns="">
<xsd:element name="root" msdata:IsDataSet="true"></xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<data name="Length_of_value_array_must_not_be_more_than_length_of_destination" xml:space="preserve">
<value>Length of value array must not be more than length of destination</value>
</data>
<data name="Offset" xml:space="preserve">
<value>Offset</value>
</data>
</root>

View File

@@ -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;