414 if (!calendarDataMap.isEmpty() || bundle.isRoot()) {
415 metaInfo.get("CalendarData").add(toLanguageTag(bundle.getID()));
416 bundleGenerator.generateBundle("util", "CalendarData", bundle.getID(), true, calendarDataMap, BundleType.PLAIN);
417 }
418 }
419 if (bundleTypes.contains(Bundle.Type.FORMATDATA)) {
420 Map<String, Object> formatDataMap = extractFormatData(targetMap, bundle.getID());
421 // LocaleData.getAvailableLocales depends on having FormatData bundles around
422 if (!formatDataMap.isEmpty() || bundle.isRoot()) {
423 metaInfo.get("FormatData").add(toLanguageTag(bundle.getID()));
424 bundleGenerator.generateBundle("text", "FormatData", bundle.getID(), true, formatDataMap, BundleType.PLAIN);
425 }
426 }
427
428 // For testing
429 SortedSet<String> allLocales = new TreeSet<>();
430 allLocales.addAll(metaInfo.get("CurrencyNames"));
431 allLocales.addAll(metaInfo.get("LocaleNames"));
432 allLocales.addAll(metaInfo.get("CalendarData"));
433 allLocales.addAll(metaInfo.get("FormatData"));
434 metaInfo.put("All", allLocales);
435 }
436
437 bundleGenerator.generateMetaInfo(metaInfo);
438 }
439
440 /*
441 * Returns the language portion of the given id.
442 * If id is "root", "" is returned.
443 */
444 static String getLanguageCode(String id) {
445 int index = id.indexOf('_');
446 String lang = null;
447 if (index != -1) {
448 lang = id.substring(0, index);
449 } else {
450 lang = "root".equals(id) ? "" : id;
451 }
452 return lang;
453 }
454
|
414 if (!calendarDataMap.isEmpty() || bundle.isRoot()) {
415 metaInfo.get("CalendarData").add(toLanguageTag(bundle.getID()));
416 bundleGenerator.generateBundle("util", "CalendarData", bundle.getID(), true, calendarDataMap, BundleType.PLAIN);
417 }
418 }
419 if (bundleTypes.contains(Bundle.Type.FORMATDATA)) {
420 Map<String, Object> formatDataMap = extractFormatData(targetMap, bundle.getID());
421 // LocaleData.getAvailableLocales depends on having FormatData bundles around
422 if (!formatDataMap.isEmpty() || bundle.isRoot()) {
423 metaInfo.get("FormatData").add(toLanguageTag(bundle.getID()));
424 bundleGenerator.generateBundle("text", "FormatData", bundle.getID(), true, formatDataMap, BundleType.PLAIN);
425 }
426 }
427
428 // For testing
429 SortedSet<String> allLocales = new TreeSet<>();
430 allLocales.addAll(metaInfo.get("CurrencyNames"));
431 allLocales.addAll(metaInfo.get("LocaleNames"));
432 allLocales.addAll(metaInfo.get("CalendarData"));
433 allLocales.addAll(metaInfo.get("FormatData"));
434 metaInfo.put("AvailableLocales", allLocales);
435 }
436
437 bundleGenerator.generateMetaInfo(metaInfo);
438 }
439
440 /*
441 * Returns the language portion of the given id.
442 * If id is "root", "" is returned.
443 */
444 static String getLanguageCode(String id) {
445 int index = id.indexOf('_');
446 String lang = null;
447 if (index != -1) {
448 lang = id.substring(0, index);
449 } else {
450 lang = "root".equals(id) ? "" : id;
451 }
452 return lang;
453 }
454
|