8015986: Incorrect Localization of HijrahChronology
authorokutsu
Thu, 08 Aug 2013 13:51:55 +0900
changeset 19371 bb9611d0308c
parent 19226 d5febab8765d
child 19372 e404c834f1cd
8015986: Incorrect Localization of HijrahChronology Reviewed-by: naoto Contributed-by: scolebourne@joda.org, roger.riggs@oracle.com
jdk/make/tools/src/build/tools/cldrconverter/CLDRConverter.java
jdk/make/tools/src/build/tools/cldrconverter/CalendarType.java
jdk/src/share/classes/sun/text/resources/FormatData.java
jdk/src/share/classes/sun/text/resources/ar/FormatData_ar.java
jdk/test/java/time/test/java/time/format/TestNonIsoFormatter.java
--- a/jdk/make/tools/src/build/tools/cldrconverter/CLDRConverter.java	Wed Aug 07 16:29:36 2013 -0700
+++ b/jdk/make/tools/src/build/tools/cldrconverter/CLDRConverter.java	Thu Aug 08 13:51:55 2013 +0900
@@ -605,7 +605,23 @@
                 copyIfPresent(map, key, formatData);
             }
         }
-
+        // Workaround for islamic-umalqura name support (JDK-8015986)
+        switch (id) {
+        case "ar":
+            map.put(CLDRConverter.CALENDAR_NAME_PREFIX
+                    + CalendarType.ISLAMIC_UMALQURA.lname(),
+                    // derived from CLDR 24 draft
+                    "\u0627\u0644\u062a\u0642\u0648\u064a\u0645 "
+                    +"\u0627\u0644\u0625\u0633\u0644\u0627\u0645\u064a "
+                    +"[\u0623\u0645 \u0627\u0644\u0642\u0631\u0649]");
+            break;
+        case "en":
+            map.put(CLDRConverter.CALENDAR_NAME_PREFIX
+                    + CalendarType.ISLAMIC_UMALQURA.lname(),
+                    // derived from CLDR 24 draft
+                    "Islamic Calendar [Umm al-Qura]");
+            break;
+        }
         // Copy available calendar names
         for (String key : map.keySet()) {
             if (key.startsWith(CLDRConverter.CALENDAR_NAME_PREFIX)) {
--- a/jdk/make/tools/src/build/tools/cldrconverter/CalendarType.java	Wed Aug 07 16:29:36 2013 -0700
+++ b/jdk/make/tools/src/build/tools/cldrconverter/CalendarType.java	Thu Aug 08 13:51:55 2013 +0900
@@ -31,7 +31,8 @@
  * Constants for the Calendars supported by JRE.
  */
 enum CalendarType {
-    GREGORIAN("gregory"), BUDDHIST, JAPANESE, ROC, ISLAMIC, ISLAMIC_CIVIL("islamicc");
+    GREGORIAN("gregory"), BUDDHIST, JAPANESE, ROC,
+    ISLAMIC, ISLAMIC_CIVIL("islamicc"), ISLAMIC_UMALQURA("islamic-umalqura");
 
     private static final int[][] ERA_DATA = {
         // start index, array length
@@ -41,6 +42,7 @@
         {0,   2},   // roc (Minguo)
         {0,   1},   // islamic (Hijrah)
         {0,   1},   // islamicc (same as islamic)
+        {0,   1},   // islamic-umalqura
     };
 
     private final String lname; // lowercase name
@@ -52,8 +54,8 @@
 
     private CalendarType(String uname) {
         String lname = name().toLowerCase(Locale.ROOT);
-        if (lname.equals("islamic_civil")) {
-            lname = "islamic-civil";
+        if (lname.startsWith("islamic_")) {
+            lname = lname.replace('_', '-');
         }
         this.lname = lname;
         this.uname = (uname != null) ? uname : lname;
--- a/jdk/src/share/classes/sun/text/resources/FormatData.java	Wed Aug 07 16:29:36 2013 -0700
+++ b/jdk/src/share/classes/sun/text/resources/FormatData.java	Thu Aug 08 13:51:55 2013 +0900
@@ -858,6 +858,9 @@
                 }
             },
             { "DateTimePatternChars", "GyMdkHmsSEDFwWahKzZ" },
+
+            // Workaround for islamic-umalqura name support (JDK-8015986)
+            { "calendarname.islamic-umalqura", "Islamic Umm al-Qura Calendar" },
         };
     }
 }
--- a/jdk/src/share/classes/sun/text/resources/ar/FormatData_ar.java	Wed Aug 07 16:29:36 2013 -0700
+++ b/jdk/src/share/classes/sun/text/resources/ar/FormatData_ar.java	Thu Aug 08 13:51:55 2013 +0900
@@ -264,6 +264,10 @@
                 }
             },
             { "DateTimePatternChars", "GanjkHmsSEDFwWxhKzZ" },
+
+            // Workaround for islamic-umalqura name support (JDK-8015986)
+            { "calendarname.islamic-umalqura",
+              "\u0644\u062a\u0642\u0648\u064a\u0645 \u0627\u0644\u0647\u062c\u0631\u064a\u060c \u0623\u0645 \u0627\u0644\u0642\u0631\u0649" },
         };
     }
 }
--- a/jdk/test/java/time/test/java/time/format/TestNonIsoFormatter.java	Wed Aug 07 16:29:36 2013 -0700
+++ b/jdk/test/java/time/test/java/time/format/TestNonIsoFormatter.java	Thu Aug 08 13:51:55 2013 +0900
@@ -110,7 +110,7 @@
             // Chronology, Locale, Chronology Name
             { ISO8601,  Locale.ENGLISH, "ISO" },    // No data in CLDR; Use Id.
             { BUDDHIST, Locale.ENGLISH, "Buddhist Calendar" },
-            { HIJRAH,   Locale.ENGLISH, "Hijrah-umalqura" }, // No data in CLDR; Use Id.
+            { HIJRAH,   Locale.ENGLISH, "Islamic Umm al-Qura Calendar" }, // JDK-8015986
             { JAPANESE, Locale.ENGLISH, "Japanese Calendar" },
             { MINGUO,   Locale.ENGLISH, "Minguo Calendar" },
 
@@ -121,6 +121,10 @@
             { ISO8601,  thTH, "ISO" },    // No data in CLDR; Use Id.
             { JAPANESE, thTH, "\u0e1b\u0e0f\u0e34\u0e17\u0e34\u0e19\u0e0d\u0e35\u0e48\u0e1b\u0e38\u0e48\u0e19" },
             { BUDDHIST, thTH, "\u0e1b\u0e0f\u0e34\u0e17\u0e34\u0e19\u0e1e\u0e38\u0e17\u0e18" },
+
+            { HIJRAH,   ARABIC, "\u0644\u062a\u0642\u0648\u064a\u0645 "
+                                + "\u0627\u0644\u0647\u062c\u0631\u064a\u060c "
+                                + "\u0623\u0645 \u0627\u0644\u0642\u0631\u0649" }, // JDK-8015986
         };
     }