获取不同语言的系统时区 [英] Getting system Timezones in different languages

查看:26
本文介绍了获取不同语言的系统时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在获取所有时区的列表,如下所示:

I'm currently getting the list of all timezones like this:

var TheListOfAllTimezones = TimeZoneInfo.GetSystemTimeZones();

例如,巴黎的时区具有 W 的 DisplayName 属性.欧洲标准时间.现在我如何用另一种语言获得这个列表?例如,对于法国的用户,我想显示 Heure Europe de l'Ouest.

So for instance, the timezone in Paris has a DisplayName property of W. Europe Standard Time. Now how do I get this list in another language? For instance, for users in France, I'd like to display Heure Europe de l'Ouest.

谢谢.

推荐答案

更改 CurrentCulture 不起作用,因为信息来自注册表 (XP) 或多语言用户界面 (MUI) DLL(Vista、Windows 7).

Changing the CurrentCulture doesn't work as the information comes from the registry (XP) or from the Multilingual User Interface (MUI) DLL (Vista, Windows 7).

在 Vista 或 Windows 7 上,您可以安装其他语言并更改显示语言(区域和语言 -> 键盘和语言 -> 显示语言).需要重新启动.这个,也只有这个,实际上会改变 TimeZoneInfo 中使用的语言.

On Vista or Windows 7, you may install other languages and change the display language (Region and Language -> Keyboards and languages -> Display language). A reboot is required. This, and only this, will actually change the language used in TimeZoneInfo.

在 Windows 7 上,只有 Ultimate 和 Enterprise 允许安装其他语言 - 通过安装 多语言用户界面包.

On Windows 7, only Ultimate and Enterprise allow the installation of other languages - by means of installing Multilingual User Interface Packs.

安装其他语言后,您应该能够在 system32 文件夹中找到 DLL(查找 tzres),并可以使用 Visual Studio 导出资源.

Once you installed other languages, you should be able to find the DLLs in the system32 folder (look for tzres) and maybe export the resources with Visual Studio.

关于可信/官方来源 - BCL团队的一篇关于msdn的文章:

...显示字符串从 Multilingual User 加载接口 (MUI) DLL、tzres.dll 或直接来自注册表,当MUI 支持不可用.支持 MUI 的操作系统,例如Windows Vista 包含 MUI_DisplayMUI_StdMUI_Dlt 键,它们由操作系统区域设置间接控制.在 Windows XP 和 Windows Server 2003 等下层平台上,只有 DisplayStdDlt 键存在.DisplayStdDlt键值仅本地化为操作的默认语言系统.

...the display strings are loaded either from the Multilingual User Interface (MUI) DLL, tzres.dll, or straight from the registry, when MUI support is unavailable. MUI-enabled operating systems such as Windows Vista contain MUI_Display, MUI_Std, and MUI_Dlt keys, which are indirectly controlled by the operating systems regional settings. On down-level platforms such as Windows XP and Windows Server 2003, only the Display, Std, and Dlt keys exist. The Display, Std, and Dlt key values are localized only in the default language of the operating system.

那么他们对 CurrentUICulture 写了什么?

So what did they write about CurrentUICulture ?

由于 Windows 时区注册表架构,CurrentUICulture 设置不会影响这些值TimeZoneInfo 属性.

Because of the Windows time zone registry architecture, CurrentUICulture settings do not impact the values of these TimeZoneInfo properties.

这篇关于获取不同语言的系统时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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