类似于本地化与winforms的工作方式.如果语言是默认的,它会在表单中声明.
让我们说如果我在en-US – 我怎么能通过代码告诉en.US是否是实际的默认值?
我需要为.net不支持的某些XML文件实现一些本地化,因此我想实现自己的…
并且做winforms如何工作,即
nameofxml.default.xml (this is the default local)nameofXml.de-de.xml (this is german)
等等
财产存在吗?
解决方法 System.Globalization.CultureInfo.CurrentCulture表示系统的控制面板区域设置,而System.Globalization.CultureInfo.CurrentUICulture对应于系统的输入UI语言设置(除非安装了多语言用户界面,否则无法更改).因此,您可以使用以下代码段来确定“默认”文化:
using System.Globalization;// N.B. execute the following line *before* you programmatically change the CurrentCulture// (if you ever do this,of course)// Gets the CultureInfo that represents the culture used by the current threadCultureInfo culture = CultureInfo.CurrentCulture;string code = culture.IEtfLanguageTag; // e.g. "en-US","de-DE",etc.
然后,您可以使用该代码来查找.xml文件.
总结以上是内存溢出为你收集整理的c#:在一个dotnet类中有一个属性,说明“当前”文化是否真的是默认文化?全部内容,希望文章能够帮你解决c#:在一个dotnet类中有一个属性,说明“当前”文化是否真的是默认文化?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)