从.NET应用程序的角度来看,CurrentUICulture设置在Windows 7中的哪个位置? [英] Where does CurrentUICulture setting reside in Windows 7 from a .NET app perspective?

查看:107
本文介绍了从.NET应用程序的角度来看,CurrentUICulture设置在Windows 7中的哪个位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想测试我的应用在不同文化下的工作方式. 因此,出于测试目的,在Windows 7下,我尝试更改系统设置中的CurrentUICulture.

I would like to test how my app would work under different cultures. So for testing purposes, under Windows 7, I tried to change CurrentUICulture in system settings.

这似乎是正确的选择:Language for non-Unicode programs 如此处建议,但它不起作用,即应用的语言环境仍为英语.

This seems to be the right option: Language for non-Unicode programs as suggested here, but it does not work, i.e. app's locale is still English.

我也在Region and Language对话框中尝试过此操作:

I also tried this in Region and Language dialog:

  • 格式:将格式更改为另一种文化
  • 位置:将当前位置设置为另一个国家/地区.

问题是我应该在Windows 7中设置什么才能影响它:

The question is what should I set in Windows 7 for it to affect:

Thread.CurrentThread.CurrentUICulture

不用写这个:

Thread.CurrentThread.CurrentUICulture = New CultureInfo("fr")

最终,此代码应选择正确的区域性,获取正确后缀的资源文件,并将其显示在屏幕上(使用上面的代码行):

Ultimately, this code should pick the correct culture, get the correctly suffixed resource file and display it on the screen (which it does with the above line in place):

Label1.Text = My.Resources.Form1Resource.TestString

在StackOverflow上也提出了类似的问题,但没有一个答案解决了这个问题.

A similar question has been asked on StackOverflow, but none of the answers addressed this issue.

推荐答案

旋钮位于区域和语言"控制面板的键盘和语言"选项卡上.点击安装/卸载语言…"按钮开始.如果仅安装了一种UI语言,则需要安装另一种.向导将引导您完成此过程.您还必须注销并重新登录才能看到效果.

The knob is on the "Keyboard and Languages" tab of the "Region and Language" control panel. Click on the "Install/uninstall languages…" button to get started. If you only have one UI language installed, you will need to install another one. The wizard should walk you through this. You will also have to log off and log back on in order to see the effect.

在大多数情况下,CurrentUICulture属性将返回用户首选的UI语言列表中的第一种语言,因此进行设置就足够了.其他语言将用作备用语言,以防无法使用首选语言获得必要的资源.

In most cases, the CurrentUICulture property is going to return the first language in the list of user preferred UI languages, so setting this should be sufficient. The other languages are used as fallback languages in case necessary resources are not available in the preferred language.

但是CurrentUICulture用于确定UI文化的实际算法要复杂一些:

But the actual algorithm that CurrentUICulture uses to determine the UI culture is a bit more complicated:

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