[DllImport("kernel32.dll", SetLastError=true)]
static extern short GetSystemDefaultLangID();
int i=GetSystemDefaultLangID();
switch(i)
{
case 2052:MessageBox.Show("中文操作系统");break;
case 1041:MessageBox.Show("日文");break;
}
static extern short GetSystemDefaultLangID();
int i=GetSystemDefaultLangID();
switch(i)
{
case 2052:MessageBox.Show("中文操作系统");break;
case 1041:MessageBox.Show("日文");break;
}
不过这是一种直接调用API的方式,C#有没有提供相关的功能呢?
属性值
格式为“<languagecode2>-<country/regioncode2>”的区域性名称,其中 <languagecode2> 是从 ISO 639-1 派生的由两个小写字母构成的代码,<country/regioncode2> 是从 ISO 3166 派生的由两个大写字母构成的代码。备注
CultureInfo.Name 属性遵循 RFC 1766 标准,格式为“<languagecode2>-<country/regioncode2>”,其中 <languagecode2> 是从 ISO 639-1 派生的由两个小写字母构成的代码,<country/regioncode2> 是从 ISO 3166 派生的由两个大写字母构成的代码。例如,特定区域性美国英语的 Name 为“en-US”。在双字母语言代码不可用的情况中,将使用从 ISO 639-2 派生的三字母代码;例如,三字母代码“div”用于使用 Dhivehi 语言的区域。如果区域性是非特定区域性,则其 Name 的格式为“<languagecode2>”。例如,非特定区域性英语的 Name 为“en”。预定义的 CultureInfo 名称列在 CultureInfo 类主题中。若要获取区域性的全名,请使用 DisplayName、EnglishName 或 NativeName。msdn好像这么写的
-______________________-b