changeset 7847:0beaa65c90c8

8015986: Incorrect Localization of HijrahChronology Reviewed-by: naoto Contributed-by: scolebourne@joda.org, roger.riggs@oracle.com
author okutsu
date Thu, 08 Aug 2013 13:51:55 +0900
parents 8c50c27418d3
children 2c4f1081a0fa
files make/tools/src/build/tools/cldrconverter/CLDRConverter.java make/tools/src/build/tools/cldrconverter/CalendarType.java src/share/classes/sun/text/resources/FormatData.java src/share/classes/sun/text/resources/ar/FormatData_ar.java test/java/time/test/java/time/format/TestNonIsoFormatter.java
diffstat 5 files changed, 34 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/make/tools/src/build/tools/cldrconverter/CLDRConverter.java	Wed Aug 07 16:29:36 2013 -0700
+++ b/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/make/tools/src/build/tools/cldrconverter/CalendarType.java	Wed Aug 07 16:29:36 2013 -0700
+++ b/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/src/share/classes/sun/text/resources/FormatData.java	Wed Aug 07 16:29:36 2013 -0700
+++ b/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/src/share/classes/sun/text/resources/ar/FormatData_ar.java	Wed Aug 07 16:29:36 2013 -0700
+++ b/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/test/java/time/test/java/time/format/TestNonIsoFormatter.java	Wed Aug 07 16:29:36 2013 -0700
+++ b/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
         };
     }