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.
How about to create some class like "TimeZoneInfoExtension" which will have static method named like ToLocolizedString:
Where i18n is a class with resources. And yes, you have to fill translations manualy. But I just used something like this in different system languages to generate translations:
And then you can get use it depending on your CurrentCulture like so:
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:
So what did they write about
CurrentUICulture
?From the documentation:
Have you tried changing the current culture to the user's culture before getting the list?
That might not work. It's possible that the only display names available are those for the Windows version that's installed. That is, if you have a US-English version of Windows, the French display names might not be there. Looking at my Registry (
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Time Zones
), I see only the English names.If the
CurrentCulture
of your thread is French ("fr-FR"), and if that language is "native" with your Windows version, then the propertiesStandardName
andDaylightName
will be in French, it seems.Edit:
It doesn't look like changing the
CurrentCulture
of the thread will help. The time zones all come from the Registry (see Jim Mischel's answer for the path), and it looks like the language of the Windows installation determines the values. The IDs (which are keys in the Registry path) are always in English, while the other properties depend on the Windows language.What is your output of the following code: