使用wpflocalizeextension更改文化 [英] change culture using wpflocalizeextension

查看:235
本文介绍了使用wpflocalizeextension更改文化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许很简单,但是如何在后面的代码中更改区域性以允许wpflocalizeextension显示所需的资源?

maybe it's very simple, but how to change the culture in code behind to allow the wpflocalizeextension to show the desired resource?

我试图改变应用程序的文化,但是什么也没做!

I tried to change the application culture, but it did nothing!!

推荐答案

为了在运行时更改当前区域性,请使用以下两个语句.使用SetCurrentThreadCulture,还可以更新当前线程的区域性.

In order to change the current culture at runtime you use the following two statements. With SetCurrentThreadCulture, also the culture of the current thread is updated.

WPFLocalizeExtension.Engine.LocalizeDictionary.Instance.SetCurrentThreadCulture = true;
WPFLocalizeExtension.Engine.LocalizeDictionary.Instance.Culture = new CultureInfo("en");

要获取可用的CultureInfo对象的列表,可以使用

To get a list of available CultureInfo objects, you can use

WPFLocalizeExtension.Engine.LocalizeDictionary.Instance.MergedAvailableCultures

这篇关于使用wpflocalizeextension更改文化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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