views:

252

answers:

2

Does anyone know of a compiled list of translations for the time zone names in Windows? I need all 75 or so of them in German, French and Spanish. Alternatively, how would I use .Net to compile such a list?

Example format: (GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague

+2  A: 

Get the time zone database from ftp://elsie.nci.nih.gov/pub or the many other source on the web. These will be keyed in UN ISO codes and English country/City names

And then translate them from http://www.unicode.org/cldr/

e.g.

TFD
+1  A: 

There is a list of all the time zones in the registry at:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones

Which can be loaded using:

ArrayList zones = new ArrayList();

using( RegistryKey key = Registry.LocalMachine.OpenSubKey(
 @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones" ) )
{
 string[] zoneNames = key.GetSubKeyNames();

 foreach( string zoneName in zoneNames )
 {
  using( RegistryKey subKey = key.OpenSubKey( zoneName ) )
  {
   TimeZoneInformation tzi = new TimeZoneInformation();
   tzi.Name = zoneName;
   tzi.DisplayName = (string)subKey.GetValue( "Display" );
   tzi.StandardName = (string)subKey.GetValue( "Std" );
   tzi.DaylightName = (string)subKey.GetValue( "Dlt" );
   object value = subKey.GetValue( "Index" );
   if( value != null )
   {
    tzi.Index = (int)value;
   }

   tzi.InitTzi( (byte[])subKey.GetValue( "Tzi" ) );

   zones.Add( tzi );
  }
 }
}

Where TimeZoneInformation is just a class which stores the information for easy access.

The description you're looking for is in the Display value.

bstoney