2009-05-21 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Thu, 21 May 2009 02:20:16 +0000 (02:20 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Thu, 21 May 2009 02:20:16 +0000 (02:20 -0000)
* CultureInfo.cs : it seems that zh-Hant and zh-Hans are introduced
  as almost alias  of zh-CHS/zh-CHT in vista and some new windows.
  Add hacky support for them.

* CultureInfoTest.cs : test zh-Hant.

svn path=/trunk/mcs/; revision=134499

mcs/class/corlib/System.Globalization/ChangeLog
mcs/class/corlib/System.Globalization/CultureInfo.cs
mcs/class/corlib/Test/System.Globalization/ChangeLog
mcs/class/corlib/Test/System.Globalization/CultureInfoTest.cs

index 9cd130ec5f184f95d6aebee5035d8aab751166a0..c55a90c1cbb634501de6b02bbbb742dfd70ce6e4 100644 (file)
@@ -1,3 +1,9 @@
+2009-05-21  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * CultureInfo.cs : it seems that zh-Hant and zh-Hans are introduced
+         as almost alias  of zh-CHS/zh-CHT in vista and some new windows.
+         Add hacky support for them.
+
 2009-01-07  Atsushi Enomoto  <atsushi@ximian.com>
 
        * CompareInfo.cs : Fixed bug #462957. With empty target string it
 2009-01-07  Atsushi Enomoto  <atsushi@ximian.com>
 
        * CompareInfo.cs : Fixed bug #462957. With empty target string it
index 724eacc32eba636d6aca5313e804c8b1007f86ce..e59c82b9f872776544c33e40b5fa76b7ea30b00c 100644 (file)
@@ -619,6 +619,18 @@ namespace System.Globalization
 
                bool ConstructInternalLocaleFromName (string locale)
                {
 
                bool ConstructInternalLocaleFromName (string locale)
                {
+                       // It is sort of hack to get those new pseudo-alias
+                       // culture names that are not supported in good old
+                       // Windows.
+                       switch (locale) {
+                       case "zh-hans":
+                               locale = "zh-chs";
+                               break;
+                       case "zh-hant":
+                               locale = "zh-cht";
+                               break;
+                       }
+
                        if (!construct_internal_locale_from_name (locale))
                                return false;
                        return true;
                        if (!construct_internal_locale_from_name (locale))
                                return false;
                        return true;
index 78a160906dbf7f41cabf99fdd8fe87cfd2f3652e..67fc845b67ee72fa2ceefd47f4711cda0e034d88 100644 (file)
@@ -1,3 +1,7 @@
+2009-05-21  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * CultureInfoTest.cs : test zh-Hant.
+
 2009-01-07  Atsushi Enomoto  <atsushi@ximian.com>
 
        * CompareInfoTest.cs : added test for #462957.
 2009-01-07  Atsushi Enomoto  <atsushi@ximian.com>
 
        * CompareInfoTest.cs : added test for #462957.
index 29a410fb2e7bd13872e3ed56b312a11a30ce4a8d..e8504054585c0e0c39a5f9bdc4daf42b5befef68 100644 (file)
@@ -496,5 +496,12 @@ namespace MonoTests.System.Globalization
                        ms.Seek (0, SeekOrigin.Begin);
                        var deserializedCulture = (CultureInfo) formatter.Deserialize (ms);
                }
                        ms.Seek (0, SeekOrigin.Begin);
                        var deserializedCulture = (CultureInfo) formatter.Deserialize (ms);
                }
+
+               [Test]
+               public void ZhHant ()
+               {
+                       Assert.AreEqual (31748, new CultureInfo ("zh-Hant").LCID);
+                       Assert.AreEqual (31748, CultureInfo.GetCultureInfo ("zh-Hant").LCID);
+               }
        }
 }
        }
 }