7073906: Locale.getDefault() returns wrong Locale for Java SE 7
authornaoto
Wed, 17 Aug 2011 11:09:06 -0700
changeset 10338 ffaa7122547c
parent 10337 2be109ecafb6
child 10339 80d9f4bc094b
7073906: Locale.getDefault() returns wrong Locale for Java SE 7 Reviewed-by: okutsu
jdk/src/windows/native/java/lang/java_props_md.c
--- a/jdk/src/windows/native/java/lang/java_props_md.c	Tue Aug 16 08:53:03 2011 +0800
+++ b/jdk/src/windows/native/java/lang/java_props_md.c	Wed Aug 17 11:09:06 2011 -0700
@@ -563,6 +563,18 @@
         {
             char * display_encoding;
 
+            // Windows UI Language selection list only cares "language"
+            // information of the UI Language. For example, the list
+            // just lists "English" but it actually means "en_US", and
+            // the user cannot select "en_GB" (if exists) in the list.
+            // So, this hack is to use the user LCID region information
+            // for the UI Language, if the "language" portion of those
+            // two locales are the same.
+            if (PRIMARYLANGID(LANGIDFROMLCID(userDefaultLCID)) ==
+                PRIMARYLANGID(LANGIDFROMLCID(userDefaultUILang))) {
+                userDefaultUILang = userDefaultLCID;
+            }
+
             SetupI18nProps(userDefaultUILang,
                            &sprops.language,
                            &sprops.script,