MultiLanguageForXAML 2.1.3
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package MultiLanguageForXAML --version 2.1.3
NuGet\Install-Package MultiLanguageForXAML -Version 2.1.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MultiLanguageForXAML" Version="2.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MultiLanguageForXAML --version 2.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MultiLanguageForXAML, 2.1.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MultiLanguageForXAML as a Cake Addin #addin nuget:?package=MultiLanguageForXAML&version=2.1.3 // Install MultiLanguageForXAML as a Cake Tool #tool nuget:?package=MultiLanguageForXAML&version=2.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MultiLanguageForXAML
针对WPF的多语言支持库
Nuget
效果预览
- WPF
用法
- 定义语言文件
//Languages/zh.json 编译时拷贝到目录
{
"txt": "一",
"format":"你好 {0} !",
"world":"世界"
}
//Languages/en.json 编译时拷贝到目录
{
"txt": "one",
"format":"hello {0} !",
"world":"world"
}
- 初始化
//WPF
//怀疑用Environment.CurrentDirectory开机启动时目录会出错,待验证
string appDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
string path = Path.Combine(appDir, "Res\\Languages");
LanService.Init(new JsonDB(path), true);
- XAML
<Window
...
xmlns:lan="clr-namespace:MultiLanguageManager;assembly=MultiLanguageManager.WPF">
<StackPanel>
<Button lan:Xaml.Key="txt" />
<Button lan:Xaml.Key="format">
<lan:Xaml.Parameters>
<lan:FormatParameters>
<Run
lan:Xaml.Key="world"
FontStyle="Italic"
Foreground="Red" />
</lan:FormatParameters>
</lan:Xaml.Parameters>
</Button>
</StackPanel>
</Window/>
- 切换语言
//WPF
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(CultureName);
LanService.UpdateLanguage();
QQ群交流:
C#全栈开发:191034956
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0-windows7.0 is compatible. net7.0-windows was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0-windows7.0
- No dependencies.
NuGet packages (5)
Showing the top 5 NuGet packages that depend on MultiLanguageForXAML:
Package | Downloads |
---|---|
JsonConfiger
根据JSON生成WPF/UWP配置界面 |
|
GiantappConfiger
懒人专用配置界面生成器,根据传入对象自动生成UI界面 giantapp.cn mscoder.cn |
|
DotNetUtil.Common.Apps
Package Description |
|
JsonConfiger.WPF
mscoder.cn |
|
Common.Apps
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.3.0.2 | 366 | 11/13/2023 |
2.3.0.1 | 162 | 10/9/2023 |
2.3.0 | 131 | 10/9/2023 |
2.2.0 | 472 | 8/8/2022 |
2.1.8 | 423 | 6/28/2022 |
2.1.7 | 435 | 5/20/2022 |
2.1.6 | 502 | 1/28/2022 |
2.1.5 | 440 | 1/28/2022 |
2.1.4 | 427 | 1/28/2022 |
2.1.3 | 441 | 1/28/2022 |
2.1.0 | 464 | 1/28/2022 |
2.0.6.1 | 403 | 3/22/2022 |
2.0.5.1 | 875 | 9/26/2019 |
2.0.3 | 1,590 | 9/9/2019 |
2.0.2.5 | 901 | 8/14/2019 |
2.0.2.4 | 549 | 8/14/2019 |
2.0.2.3 | 520 | 8/14/2019 |
2.0.2.2 | 518 | 8/14/2019 |
2.0.2 | 541 | 8/14/2019 |
2.0.0 | 758 | 6/4/2019 |
1.0.0.21 | 670 | 4/28/2019 |
1.0.0.20 | 562 | 4/29/2019 |
1.0.0.19 | 560 | 4/29/2019 |
1.0.0.18 | 874 | 8/31/2018 |
1.0.0.15 | 736 | 8/29/2018 |
1.0.0.13 | 769 | 8/29/2018 |
1.0.0.11 | 825 | 8/7/2018 |
1.0.0.10 | 769 | 8/3/2018 |