代码之家  ›  专栏  ›  技术社区  ›  Greg

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

  •  5
  • Greg  · 技术社区  · 17 年前

    有人知道Windows中时区名称的翻译编译列表吗?我需要75种左右的德语、法语和西班牙语。或者,我该如何使用。网要编这样的名单?

    3 回复  |  直到 13 年前
        2
  •  3
  •   Raymond Chen    13 年前
        3
  •  0
  •   bstoney    17 年前

    注册表中的所有时区列表位于:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\当前版本\时区

    可以使用以下方式加载:

    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 );
            }
        }
    }
    

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

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