c#:在一个dotnet类中有一个属性,说明“当前”文化是否真的是默认文化?

某些课程中是否有某个属性可以告诉我当前的文化是否真的是认文化.

类似于本地化与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 thread
CultureInfo culture = CultureInfo.CurrentCulture;
string code = culture.IetfLanguageTag; // e.g. "en-US","de-DE",etc.

然后,您可以使用该代码来查找.xml文件.

相关文章

在要实现单例模式的类当中添加如下代码:实例化的时候:frmC...
1、如果制作圆角窗体,窗体先继承DOTNETBAR的:public parti...
根据网上资料,自己很粗略的实现了一个winform搜索提示,但是...
近期在做DSOFramer这个控件,打算自己弄一个自定义控件来封装...
今天玩了一把WMI,查询了一下电脑的硬件信息,感觉很多代码都...
最近在研究WinWordControl这个控件,因为上级要求在系统里,...