Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
626 views
in Technique[技术] by (71.8m points)

c# - Getting system Timezones in different languages

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

var TheListOfAllTimezones = TimeZoneInfo.GetSystemTimeZones();

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.

Thanks.

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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).

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.

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

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.

As to credible/official sources - how about an article on msdn of the BCL Team:

...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.

So what did they write about CurrentUICulture ?

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...