使用CultureInfo和RegionInfo类进行全球化和本地化

            //今天农历

            ChineseLunisolarCalendar cnDate = new ChineseLunisolarCalendar();
            Console.WriteLine("今天农历是:" + cnDate.GetYear(DateTime.Today).ToString() + "年" + cnDate.GetMonth(DateTime.Today).ToString() + "月" + cnDate.GetDayOfMonth(DateTime.Today).ToString()+"日");
            Console.WriteLine();

            CultureInfo c = new CultureInfo("zh-Hans"); //zh-Hans简体中文;zh-Hant繁体中文
            Console.WriteLine("The CultureInfo is set to: {0}", c.DisplayName); //采用 .NET Framework 本地化版本的语言的区域性名称
            Console.WriteLine("The parent culture is: {0}", c.Parent.DisplayName);
            Console.WriteLine("The three letter ISO language name is: {0}", c.ThreeLetterISOLanguageName);
            Console.WriteLine("The default calendar for this culture is: {0}\n\n", c.Calendar);

            RegionInfo r2 = new RegionInfo("cn");
            Console.WriteLine("The name of this region is: {0}", r2.Name);
            Console.WriteLine("The NativeName  of this region is: {0}", r2.NativeName);
            Console.WriteLine("The ISO currency symbol for the region is: {0}", r2.ISOCurrencySymbol); //获取与国家/地区关联的由三个字符组成的 ISO 4217 货币符号
            Console.WriteLine("this CurrentRegion: {0}", r2.CurrencyNativeName);

            Console.ReadLine();

posted @ 2010-06-03 14:10  top1  阅读(904)  评论(0编辑  收藏  举报