jdk/make/tools/src/build/tools/cldrconverter/LDMLParseHandler.java
changeset 14765 0987999ed367
parent 13583 dc0017b1a452
child 15281 dd43cb9be0e1
equal deleted inserted replaced
14764:6dd2370b4cd3 14765:0987999ed367
   153                     pushStringArrayEntry(qName, attributes, prefix + "MonthNames/" + getContainerKey(), 13);
   153                     pushStringArrayEntry(qName, attributes, prefix + "MonthNames/" + getContainerKey(), 13);
   154                     break;
   154                     break;
   155                 case "abbreviated":
   155                 case "abbreviated":
   156                     pushStringArrayEntry(qName, attributes, prefix + "MonthAbbreviations/" + getContainerKey(), 13);
   156                     pushStringArrayEntry(qName, attributes, prefix + "MonthAbbreviations/" + getContainerKey(), 13);
   157                     break;
   157                     break;
       
   158                 case "narrow":
       
   159                     pushStringArrayEntry(qName, attributes, prefix + "MonthNarrows/" + getContainerKey(), 13);
       
   160                     break;
   158                 default:
   161                 default:
   159                     pushIgnoredContainer(qName);
   162                     pushIgnoredContainer(qName);
   160                     break;
   163                     break;
   161                 }
   164                 }
   162             }
   165             }
   189                     pushStringArrayEntry(qName, attributes, prefix + "DayNames/" + getContainerKey(), 7);
   192                     pushStringArrayEntry(qName, attributes, prefix + "DayNames/" + getContainerKey(), 7);
   190                     break;
   193                     break;
   191                 case "abbreviated":
   194                 case "abbreviated":
   192                     pushStringArrayEntry(qName, attributes, prefix + "DayAbbreviations/" + getContainerKey(), 7);
   195                     pushStringArrayEntry(qName, attributes, prefix + "DayAbbreviations/" + getContainerKey(), 7);
   193                     break;
   196                     break;
       
   197                 case "narrow":
       
   198                     pushStringArrayEntry(qName, attributes, prefix + "DayNarrows/" + getContainerKey(), 7);
       
   199                     break;
   194                 default:
   200                 default:
   195                     pushIgnoredContainer(qName);
   201                     pushIgnoredContainer(qName);
   196                     break;
   202                     break;
   197                 }
   203                 }
   198             }
   204             }
   217             }
   223             }
   218             break;
   224             break;
   219         case "dayPeriodWidth":
   225         case "dayPeriodWidth":
   220             // for FormatData
   226             // for FormatData
   221             // create string array entry for am/pm. only keeping wide
   227             // create string array entry for am/pm. only keeping wide
   222             if ("wide".equals(attributes.getValue("type"))) {
   228             switch (attributes.getValue("type")) {
       
   229             case "wide":
   223                 pushStringArrayEntry(qName, attributes, "AmPmMarkers/" + getContainerKey(), 2);
   230                 pushStringArrayEntry(qName, attributes, "AmPmMarkers/" + getContainerKey(), 2);
   224             } else {
       
   225                 pushIgnoredContainer(qName);
       
   226             }
       
   227             break;
       
   228         case "dayPeriod":
       
   229             // for FormatData
       
   230             // add to string array entry of AmPmMarkers element
       
   231             switch (attributes.getValue("type")) {
       
   232             case "am":
       
   233                 pushStringArrayElement(qName, attributes, 0);
       
   234                 break;
   231                 break;
   235             case "pm":
   232             case "narrow":
   236                 pushStringArrayElement(qName, attributes, 1);
   233                 pushStringArrayEntry(qName, attributes, "narrow.AmPmMarkers/" + getContainerKey(), 2);
   237                 break;
   234                 break;
   238             default:
   235             default:
   239                 pushIgnoredContainer(qName);
   236                 pushIgnoredContainer(qName);
   240                 break;
   237                 break;
       
   238             }
       
   239             break;
       
   240         case "dayPeriod":
       
   241             // for FormatData
       
   242             // add to string array entry of AmPmMarkers element
       
   243             if (attributes.getValue("alt") == null) {
       
   244                 switch (attributes.getValue("type")) {
       
   245                 case "am":
       
   246                     pushStringArrayElement(qName, attributes, 0);
       
   247                     break;
       
   248                 case "pm":
       
   249                     pushStringArrayElement(qName, attributes, 1);
       
   250                     break;
       
   251                 default:
       
   252                     pushIgnoredContainer(qName);
       
   253                     break;
       
   254                 }
       
   255             } else {
       
   256                 // discard alt values
       
   257                 pushIgnoredContainer(qName);
   241             }
   258             }
   242             break;
   259             break;
   243         case "eraNames":
   260         case "eraNames":
   244             // CLDR era names are inconsistent in terms of their lengths. For example,
   261             // CLDR era names are inconsistent in terms of their lengths. For example,
   245             // the full names of Japanese imperial eras are eraAbbr, while the full names
   262             // the full names of Japanese imperial eras are eraAbbr, while the full names
   267             // mainly used for the Japanese imperial calendar
   284             // mainly used for the Japanese imperial calendar
   268             if (currentCalendarType == null) {
   285             if (currentCalendarType == null) {
   269                 assert currentContainer instanceof IgnoredContainer;
   286                 assert currentContainer instanceof IgnoredContainer;
   270                 pushIgnoredContainer(qName);
   287                 pushIgnoredContainer(qName);
   271             } else {
   288             } else {
   272                 String key = currentCalendarType.keyElementName() + "short.Eras";
   289                 String key = currentCalendarType.keyElementName() + "narrow.Eras";
   273                 pushStringArrayEntry(qName, attributes, key, currentCalendarType.getEraLength(qName));
   290                 pushStringArrayEntry(qName, attributes, key, currentCalendarType.getEraLength(qName));
   274             }
   291             }
   275             break;
   292             break;
   276         case "era":
   293         case "era":
   277             // for FormatData
   294             // for FormatData
   299         case "timeZoneNames":
   316         case "timeZoneNames":
   300             pushContainer(qName, attributes);
   317             pushContainer(qName, attributes);
   301             break;
   318             break;
   302         case "zone":
   319         case "zone":
   303             {
   320             {
   304                 String zone = attributes.getValue("type");
   321                 String tzid = attributes.getValue("type"); // Olson tz id
   305                 zonePrefix = CLDRConverter.TIMEZONE_ID_PREFIX;
   322                 zonePrefix = CLDRConverter.TIMEZONE_ID_PREFIX;
   306                 put(zonePrefix + zone, new HashMap<String, String>());
   323                 put(zonePrefix + tzid, new HashMap<String, String>());
   307                 pushKeyContainer(qName, attributes, zone);
   324                 pushKeyContainer(qName, attributes, tzid);
   308             }
   325             }
   309             break;
   326             break;
   310         case "metazone":
   327         case "metazone":
   311             {
   328             {
   312                 String zone = attributes.getValue("type");
   329                 String zone = attributes.getValue("type"); // LDML meta zone id
   313                 zonePrefix = CLDRConverter.METAZONE_ID_PREFIX;
   330                 zonePrefix = CLDRConverter.METAZONE_ID_PREFIX;
   314                 put(zonePrefix + zone, new HashMap<String, String>());
   331                 put(zonePrefix + zone, new HashMap<String, String>());
   315                 pushKeyContainer(qName, attributes, zone);
   332                 pushKeyContainer(qName, attributes, zone);
   316             }
   333             }
   317             break;
   334             break;
   321             break;
   338             break;
   322         case "short":
   339         case "short":
   323             zoneNameStyle = "short";
   340             zoneNameStyle = "short";
   324             pushContainer(qName, attributes);
   341             pushContainer(qName, attributes);
   325             break;
   342             break;
   326         case "generic": // not used in JDK
   343         case "generic":  // generic name
   327             pushIgnoredContainer(qName);
   344         case "standard": // standard time name
   328             break;
   345         case "daylight": // daylight saving (summer) time name
   329         case "standard": // standard time
   346             pushStringEntry(qName, attributes, CLDRConverter.ZONE_NAME_PREFIX + qName + "." + zoneNameStyle);
   330             pushStringEntry(qName, attributes, CLDRConverter.TIMEZONE_NAME_PREFIX + "standard." + zoneNameStyle);
   347             break;
   331             break;
   348         case "exemplarCity":  // not used in JDK
   332         case "daylight":
       
   333             pushStringEntry(qName, attributes, CLDRConverter.TIMEZONE_NAME_PREFIX + "daylight." + zoneNameStyle);
       
   334             break;
       
   335         case "exemplarCity":
       
   336             pushIgnoredContainer(qName);
   349             pushIgnoredContainer(qName);
   337             break;
   350             break;
   338 
   351 
   339         //
   352         //
   340         // Number format information
   353         // Number format information
   528             break;
   541             break;
   529 
   542 
   530         case "timeZoneNames":
   543         case "timeZoneNames":
   531             zonePrefix = null;
   544             zonePrefix = null;
   532             break;
   545             break;
       
   546         case "generic":
   533         case "standard":
   547         case "standard":
   534         case "daylight":
   548         case "daylight":
   535             if (zonePrefix != null && (currentContainer instanceof Entry)) {
   549             if (zonePrefix != null && (currentContainer instanceof Entry)) {
   536                 @SuppressWarnings("unchecked")
   550                 @SuppressWarnings("unchecked")
   537                 Map<String, String> valmap = (Map<String, String>) get(zonePrefix + getContainerKey());
   551                 Map<String, String> valmap = (Map<String, String>) get(zonePrefix + getContainerKey());