在WPF中更改语言 [英] Change language in WPF

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

问题描述



如何在不使用资源文件的情况下使用WPF将语言更改为Tamil。应该在一次选择中更改完整应用程序的语言

解决方案

全球化完全基于资源。在这种情况下,将自动选择特定文化的资源。如果您想在运行时切换文化,您所做的只是切换UI线程的文化(以及其他线程,那些使用任何文化依赖的线程)。你用这种方式切换线程的'code> CurrentCulture 和 CurrectUICulture

http://msdn.microsoft.com/en-us/library/system.threading.thread。 currentculture.aspx [ ^ ],

http: //msdn.microsoft.com/en-us/library/system.threading.thread.currentuiculture.aspx [ ^ ]。



请阅读全球化和本地化: http://msdn.microsoft.com/en-us/library/ms788718.aspx [ ^ ]。



如果你想走另一条路,你必须以一种或另一种方式重新发明像资源这样的东西。根据文化,您需要重新分配带有任何文本的每个UI元素。



但是,也许我们不了解你,因为你不喜欢不明白的东西。您真的需要将UI从一种文化切换到另一种文化吗?如果您只想用一种语言编写整个应用程序,那么您可以在没有任何全球化的情况下完成它。但是为什么?



也许你只是在谈论在泰米尔语输入数据的可能性。在这种情况下,你根本不需要任何东西。由于.NET基于Unicode,您可以随时使用任何语言输入,无论您的应用程序的文化是什么。



-SA

hi,
How to change the language to Tamil using WPF for the application without using resource files. The language should be changed for the full application in one time selection

解决方案

Globalization is totally based on resources. In this case, the resources for a particular culture are selected automatically. If you want to switch the culture during run time, all you do is switching the culture of your UI thread (and other threads, those using anything culture-depending). You switch thread''s CurrentCulture and CurrectUICulture this way:
http://msdn.microsoft.com/en-us/library/system.threading.thread.currentculture.aspx[^],
http://msdn.microsoft.com/en-us/library/system.threading.thread.currentuiculture.aspx[^].

Please read on globalization and localization: http://msdn.microsoft.com/en-us/library/ms788718.aspx[^].

If you want to go the other way, you would have to re-invent something like resource, in one or another way. You would need to re-assign each and every UI element which carries any text, according to the culture.

However, perhaps we did not understand you, because you don''t understand something. Do you really need to switch UI from one culture to another? If you simply want to write the whole application in one language, you can do it without any globalization at all. But why?

Perhaps you are talking only about the possibility to input data in Tamil. In this case, you don''t need anything at all. As .NET is based on Unicode, you can always input in any language, not matter what is the culture of your application.

—SA


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

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