From 419acbb14a422064751cbba135245d65218cd9ad Mon Sep 17 00:00:00 2001 From: Jack <3486688394@qq.com> Date: Thu, 23 Jan 2025 22:53:43 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JackCraft.I18N.sln | 6 +++ JackCraft.I18N.sln.DotSettings.user | 9 +++++ Test/App.axaml | 10 +++++ Test/App.axaml.cs | 26 +++++++++++++ Test/Assets/Resources.Designer.cs | 60 +++++++++++++++++++++++++++++ Test/Assets/Resources.en-us.resx | 24 ++++++++++++ Test/Assets/Resources.resx | 33 ++++++++++++++++ Test/Assets/Resources.zh.resx | 24 ++++++++++++ Test/MainWindow.axaml | 19 +++++++++ Test/MainWindow.axaml.cs | 23 +++++++++++ Test/Program.cs | 26 +++++++++++++ Test/Test.csproj | 41 ++++++++++++++++++++ Test/app.manifest | 18 +++++++++ 13 files changed, 319 insertions(+) create mode 100644 JackCraft.I18N.sln.DotSettings.user create mode 100644 Test/App.axaml create mode 100644 Test/App.axaml.cs create mode 100644 Test/Assets/Resources.Designer.cs create mode 100644 Test/Assets/Resources.en-us.resx create mode 100644 Test/Assets/Resources.resx create mode 100644 Test/Assets/Resources.zh.resx create mode 100644 Test/MainWindow.axaml create mode 100644 Test/MainWindow.axaml.cs create mode 100644 Test/Program.cs create mode 100644 Test/Test.csproj create mode 100644 Test/app.manifest 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 @@ + + + + +