赞
踩
xmlns:lan = "clr-namespace:MultiLanguageForXAML;assembly=MultiLanguageForXAML"
<Label lan:Xaml.Key="密码" Height="30" Width="42" FontSize="14"/>
<Label lan:Xaml.Key="账号" Height="30" Width="42" FontSize="14"/>
using System.Reflection; using System.Windows; using MultiLanguageForXAML;//引用 using MultiLanguageForXAML.DB;//引用 namespace AI { /// <summary> /// Interaction logic for App.xaml /// </summary> public partial class App : Application { //初始化引用 protected override void OnStartup(StartupEventArgs e) { string appDir = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); string path = System.IO.Path.Combine(appDir, "languages"); LanService.Init(new JsonFileDB(path), true, "zh"); } } }
LanService.UpdateCulture("zh");
{
"密码": "密码",
"账号": "账号"
}
{
"密码": "Password",
"账号": "Account"
}
多语言接口提取处:https://github.com/GiantappMan/MultiLanguageForXAML
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。