MultiLanguageForXAML 2.3.0.2
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Framework 4.6.2
This package targets .NET Framework 4.6.2. The package is compatible with this framework or higher.
dotnet add package MultiLanguageForXAML --version 2.3.0.2
NuGet\Install-Package MultiLanguageForXAML -Version 2.3.0.2
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.3.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MultiLanguageForXAML --version 2.3.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MultiLanguageForXAML, 2.3.0.2"
#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.3.0.2 // Install MultiLanguageForXAML as a Cake Tool #tool nuget:?package=MultiLanguageForXAML&version=2.3.0.2
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 JsonFileDB(path), true,"zh");
//嵌入模式
//LanService.Init(new EmbeddedJsonDB("Samples.WPF.EmbeddedConfig.Languages"), true, "en");
- XAML
<Window
...
xmlns:lan="clr-namespace:MultiLanguageForXAML;assembly=MultiLanguageForXAML">
<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
LanService.UpdateCulture("en");
- 自定义控件映射(可选)
Xaml.CustomMaps.Add(typeof(CustomTitleBar), CustomTitleBar.TitleProperty);
广而告之
全栈开发QQ群: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. |
.NET Framework | net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.6.2
- IndexRange (>= 1.0.3)
- Newtonsoft.Json (>= 13.0.3)
-
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 | 387 | 11/13/2023 |
2.3.0.1 | 167 | 10/9/2023 |
2.3.0 | 136 | 10/9/2023 |
2.2.0 | 485 | 8/8/2022 |
2.1.8 | 430 | 6/28/2022 |
2.1.7 | 442 | 5/20/2022 |
2.1.6 | 512 | 1/28/2022 |
2.1.5 | 452 | 1/28/2022 |
2.1.4 | 441 | 1/28/2022 |
2.1.3 | 451 | 1/28/2022 |
2.1.0 | 474 | 1/28/2022 |
2.0.6.1 | 410 | 3/22/2022 |
2.0.5.1 | 882 | 9/26/2019 |
2.0.3 | 1,604 | 9/9/2019 |
2.0.2.5 | 911 | 8/14/2019 |
2.0.2.4 | 556 | 8/14/2019 |
2.0.2.3 | 527 | 8/14/2019 |
2.0.2.2 | 525 | 8/14/2019 |
2.0.2 | 548 | 8/14/2019 |
2.0.0 | 765 | 6/4/2019 |
1.0.0.21 | 677 | 4/28/2019 |
1.0.0.20 | 569 | 4/29/2019 |
1.0.0.19 | 567 | 4/29/2019 |
1.0.0.18 | 887 | 8/31/2018 |
1.0.0.15 | 748 | 8/29/2018 |
1.0.0.13 | 781 | 8/29/2018 |
1.0.0.11 | 835 | 8/7/2018 |
1.0.0.10 | 779 | 8/3/2018 |