Anyone know a source for translated Time Zone descriptions?

余生长醉 提交于 2019-12-05 00:51:38

问题


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


回答1:


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.




回答2:


Get the time zone database from https://iana.org/time-zones or ftp://ftp.iana.org/tz (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.

  • French http://unicode.org/cldr/data/common/main/fr.xml
  • Spanish http://unicode.org/cldr/data/common/main/es.xml



回答3:


The Microsoft Terminology Collection is available for download for non-commercial use.



来源:https://stackoverflow.com/questions/617011/anyone-know-a-source-for-translated-time-zone-descriptions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!