有人知道翻译时区描述的来源吗?

Gre*_*reg 4 windows timezone internationalization

有谁知道Windows中时区名称的已编译翻译列表?我需要全部75个左右的德语,法语和西班牙语.或者,我如何使用.Net编译这样的列表?

示例格式:(GMT + 01:00)贝尔格莱德,布拉迪斯拉发,布达佩斯,卢布尔雅那,布拉格

TFD*_*TFD 6

https://iana.org/time-zonesftp://ftp.iana.org/tz(或网络上的许多其他来源)获取时区数据库.这些将以UN ISO代码和英语国家/城市名称为中心

然后从http://www.unicode.org/cldr/翻译它们

例如


bst*_*ney 0

注册表中包含所有时区的列表:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\时区

可以使用以下方式加载:

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 );
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

其中 TimeZoneInformation 只是一个存储信息以便于访问的类。

您要查找的描述位于“显示”值中。

  • 这个答案在几个方面似乎是错误的。首先,OP 要求翻译名称。其次,您可以简单地使用 TimeZoneInfo.GetSystemTimeZones() 而不是所示的代码。 (3认同)