更改语言在C# [英] Change Language in C#

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

问题描述

我在Windows上开发一个多语言的程序在C#

I am developing a multilingual program in C# on Windows

如何更改某些操作的Windows书写语言...
例如从英语更改为阿拉伯语的焦点事件。

How to change Windows writing language on certain actions...
e.g. to change from English to Arabic on focus event.

感谢

推荐答案

要选择一个全新的文化,将 CurrentThread.CurrentCulture 来一个新的文化,如:要设置为法语:

To select a whole new culture, set the CurrentThread.CurrentCulture to a new culture, e.g. to set to French:

System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("fr-FR");
System.Threading.Thread.CurrentThread.CurrentCulture = ci;

您可以找到pdefined的$ P $ 的CultureInfo 名称<一个列表href="http://authors.aspalliance.com/aspxtreme/sys/globalization/demos/CultureInfo.aspx">here.

You can find a list of the predefined CultureInfo names here.

如果要更改默认的文化的某些方面,你可以抓住当前线程的文化,使用它的名字来创建一个新的CultureInfo实例,并设置线程的新的文化有了一些变化,例如:改变当前区域性使用'欧元'符号:

If you want to change certain aspects of the default culture, you can grab the current thread's culture, use it it's name to create a new CultureInfo instance and set the thread's new culture with some changes, e.g. to change the current culture to use the 'Euro' symbol:

System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo( System.Threading.Thread.CurrentThread.CurrentCulture.Name);
ci.NumberFormat.CurrencySymbol = "€";
System.Threading.Thread.CurrentThread.CurrentCulture = ci;

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

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