diff --git a/JackCraft.I18N.sln b/JackCraft.I18N.sln index c19fa34..d54c1d3 100644 --- a/JackCraft.I18N.sln +++ b/JackCraft.I18N.sln @@ -8,6 +8,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Folder", "Solution Readme.MD = Readme.MD EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{933A9C2F-8C23-4898-A266-780A841218DD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -18,5 +20,9 @@ Global {C759B9D3-5362-4F9A-AE9F-FCB8B2E51B9A}.Debug|Any CPU.Build.0 = Debug|Any CPU {C759B9D3-5362-4F9A-AE9F-FCB8B2E51B9A}.Release|Any CPU.ActiveCfg = Release|Any CPU {C759B9D3-5362-4F9A-AE9F-FCB8B2E51B9A}.Release|Any CPU.Build.0 = Release|Any CPU + {933A9C2F-8C23-4898-A266-780A841218DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {933A9C2F-8C23-4898-A266-780A841218DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {933A9C2F-8C23-4898-A266-780A841218DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {933A9C2F-8C23-4898-A266-780A841218DD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/JackCraft.I18N.sln.DotSettings.user b/JackCraft.I18N.sln.DotSettings.user new file mode 100644 index 0000000..3400518 --- /dev/null +++ b/JackCraft.I18N.sln.DotSettings.user @@ -0,0 +1,9 @@ + + ForceIncluded + ForceIncluded + ForceIncluded + ForceIncluded + ForceIncluded + ForceIncluded + True + True \ No newline at end of file diff --git a/Test/App.axaml b/Test/App.axaml new file mode 100644 index 0000000..e482741 --- /dev/null +++ b/Test/App.axaml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/Test/App.axaml.cs b/Test/App.axaml.cs new file mode 100644 index 0000000..0ba308e --- /dev/null +++ b/Test/App.axaml.cs @@ -0,0 +1,26 @@ +using System.Globalization; +using Avalonia; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Markup.Xaml; +using JackCraft.I18N; + +namespace Test; + +public class App : Application +{ + public static I18NManager I18NManager { get; set; } = new("Test.Assets.Resources", typeof(App).Assembly); + + public override void Initialize() + { + I18NManager.Culture = new CultureInfo("zh"); + AvaloniaXamlLoader.Load(this); + } + + public override void OnFrameworkInitializationCompleted() + { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + desktop.MainWindow = new MainWindow(); + + base.OnFrameworkInitializationCompleted(); + } +} \ No newline at end of file diff --git a/Test/Assets/Resources.Designer.cs b/Test/Assets/Resources.Designer.cs new file mode 100644 index 0000000..16dbb6e --- /dev/null +++ b/Test/Assets/Resources.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 Test.Assets { + using System; + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static System.Resources.ResourceManager resourceMan; + + private static System.Globalization.CultureInfo resourceCulture; + + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + [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("Test.Assets.Resources", typeof(Resources).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 Test { + get { + return ResourceManager.GetString("Test", resourceCulture); + } + } + + internal static string Test1 { + get { + return ResourceManager.GetString("Test1", resourceCulture); + } + } + } +} diff --git a/Test/Assets/Resources.en-us.resx b/Test/Assets/Resources.en-us.resx new file mode 100644 index 0000000..2429691 --- /dev/null +++ b/Test/Assets/Resources.en-us.resx @@ -0,0 +1,24 @@ + + + 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 + + + + Test + + + Hello {0} + + \ No newline at end of file diff --git a/Test/Assets/Resources.resx b/Test/Assets/Resources.resx new file mode 100644 index 0000000..4c692af --- /dev/null +++ b/Test/Assets/Resources.resx @@ -0,0 +1,33 @@ + + + + + + + + + + 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 + + + + 测试 + + + 你好 {0} + + \ No newline at end of file diff --git a/Test/Assets/Resources.zh.resx b/Test/Assets/Resources.zh.resx new file mode 100644 index 0000000..821ae2a --- /dev/null +++ b/Test/Assets/Resources.zh.resx @@ -0,0 +1,24 @@ + + + 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 + + + + 测试 + + + 你好 {0} + + \ No newline at end of file diff --git a/Test/MainWindow.axaml b/Test/MainWindow.axaml new file mode 100644 index 0000000..361f456 --- /dev/null +++ b/Test/MainWindow.axaml @@ -0,0 +1,19 @@ + + + + +