WPF全球化默认资源字典开头 [英] WPF Globalization Default Resource Dictionary at the beginning

查看:88
本文介绍了WPF全球化默认资源字典开头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更改WPF项目的语言。我正在使用
中提到的方法


http://www.wpfsharp.com/2012/01/27/how-to-change-language -at-run-time-in-wpf-with-loadable-resource-dictionaries-and-dynamicresource-binding / [ ^ ]





但是默认的文化信息在开始时没有加载..

如何在开始时显示默认语言?

解决方案

您需要更改语言,而不是默认语言。默认语言是指系统默认语言,但您正在谈论应用程序的启动。



查看您引用的文章并注意以下几行:

 Thread.CurrentThread.CurrentCulture = ci; 
Thread.CurrentThread.CurrentUICulture = ci;





应该使用最接近所需文化的卫星重新加载资源程序集。 br />


也许你想切换输入语言(与键盘布局有关)?这是不同的东西。请参阅:

http://msdn.microsoft .com / zh-cn / library / system.windows.input.inputlanguagemanager.aspx [ ^ ]。



(如果你想使用 SPI_SETDEFAULTINPUTLANG 标志更改系统默认输入语言,查看 SystemParametersInfo 函数:

http://msdn.microsoft.com/en-us/library/ms724947% 28VS.85%29.aspx [ ^ ]。



这不是.NET CFL的一部分。您需要使用P / Invoke来执行此操作:

http:// en .wikipedia.org / wiki / Platform_Invocation_Services [ ^ ] ,

http://msdn.microsoft.com/library /en-us/vcmxspec/html/vcmg_PlatformInvocationServices.asp [ ^ ]。



我怀疑你真的需要它。)
-SA

I am trying to change the language of a WPF project. i am using method mentioned in

http://www.wpfsharp.com/2012/01/27/how-to-change-language-at-run-time-in-wpf-with-loadable-resource-dictionaries-and-dynamicresource-binding/[^]


But the default culture info is not getting loaded at the starting..
How to show the Default language at the starting?

解决方案

You need to change language, not default language. The default language means system default, but you are talking about start of your application.

Look at the article you referenced and pay attention for these lines:

Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;



That should reload resource assemblies with the satellites closest to the required culture.

Maybe you want to switch input language (related to keyboard layout)? This is something different. Please see:
http://msdn.microsoft.com/en-us/library/system.windows.input.inputlanguagemanager.aspx[^].

(If you want to change the system default input language look at the SystemParametersInfo function with the SPI_SETDEFAULTINPUTLANG flag:
http://msdn.microsoft.com/en-us/library/ms724947%28VS.85%29.aspx[^].

This is not a part of .NET CFL. You need to use P/Invoke to do it:
http://en.wikipedia.org/wiki/Platform_Invocation_Services[^],
http://msdn.microsoft.com/library/en-us/vcmxspec/html/vcmg_PlatformInvocationServices.asp[^].

I doubt you really need it.)
—SA


这篇关于WPF全球化默认资源字典开头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆