/** * @internal * @deprecated This API is ICU internal only. */ @Deprecated public static ICUResourceBundle getICUSupplementalData() { ICUResourceBundle suppData = (ICUResourceBundle) UResourceBundle.getBundleInstance( ICUData.ICU_BASE_NAME, "supplementalData", ICUResourceBundle.ICU_DATA_CLASS_LOADER); return suppData; }
/** * Gets the LocaleData object associated with the ULocale specified in locale * * @param locale Locale with thich the locale data object is associated. * @return A locale data object. * @stable ICU 3.4 */ public static final LocaleData getInstance(ULocale locale) { LocaleData ld = new LocaleData(); ld.bundle = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, locale); ld.langBundle = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUData.ICU_LANG_BASE_NAME, locale); ld.noSubstitute = false; return ld; }
public ICUDataTable(String path, ULocale locale, boolean nullIfNotFound) { super(nullIfNotFound); this.bundle = (ICUResourceBundle) UResourceBundle.getBundleInstance( path, locale.getBaseName()); }
private static void loadRootRules() { if (rootRules != null) { return; } synchronized(CollationLoader.class) { if (rootRules == null) { UResourceBundle rootBundle = UResourceBundle.getBundleInstance( ICUData.ICU_COLLATION_BASE_NAME, ULocale.ROOT); rootRules = rootBundle.getString("UCARules"); } } }
CalendarPreferences() { try { ICUResourceBundle rb = (ICUResourceBundle)UResourceBundle.getBundleInstance( ICUData.ICU_BASE_NAME, "supplementalData"); rb.getAllItemsWithFallback("calendarPreferenceData", this); } catch (MissingResourceException mre) { // Always use "gregorian". } }
private static String lookupLikelySubtags(String localeId) { UResourceBundle bundle = UResourceBundle.getBundleInstance( ICUData.ICU_BASE_NAME, "likelySubtags"); try { return bundle.getString(localeId); } catch(MissingResourceException e) { return null; } }
static String getTZDataVersion() { if (TZDATA_VERSION == null) { synchronized (VersionInfo.class) { if (TZDATA_VERSION == null) { UResourceBundle tzbundle = UResourceBundle.getBundleInstance("com/ibm/icu/impl/data/icudt" + VersionInfo.ICU_DATA_VERSION_PATH, "zoneinfo64"); TZDATA_VERSION = tzbundle.getString("TZVersion"); } } } return TZDATA_VERSION; } }
private static synchronized String[] getZoneIDs() { if (ZONEIDS == null) { try { UResourceBundle top = UResourceBundle.getBundleInstance( ICUData.ICU_BASE_NAME, ZONEINFORESNAME, ICUResourceBundle.ICU_DATA_CLASS_LOADER); ZONEIDS = top.getStringArray(kNAMES); } catch (MissingResourceException ex) { // throw away.. } } if (ZONEIDS == null) { ZONEIDS = new String[0]; } return ZONEIDS; }
/** * Load the Date string array */ private synchronized void loadDates() { ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, fLocale); // Use sink mechanism to traverse data structure. fDates = new ArrayList<URelativeString>(); RelDateFmtDataSink sink = new RelDateFmtDataSink(); rb.getAllItemsWithFallback("fields/day/relative", sink); }
static Set<String> _getAvailableMetaZoneIDs() { if (METAZONE_IDS == null) { synchronized (TimeZoneNamesImpl.class) { if (METAZONE_IDS == null) { UResourceBundle bundle = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, "metaZones"); UResourceBundle mapTimezones = bundle.get("mapTimezones"); Set<String> keys = mapTimezones.keySet(); METAZONE_IDS = Collections.unmodifiableSet(keys); } } } return METAZONE_IDS; }
/** * Utility to fetch locale display data from resource bundle tables. Convenience * wrapper for {@link #getTableString(ICUResourceBundle, String, String, String, String)}. */ public static String getTableString(String path, ULocale locale, String tableName, String itemName, String defaultValue) { ICUResourceBundle bundle = (ICUResourceBundle) UResourceBundle. getBundleInstance(path, locale.getBaseName()); return getTableString(bundle, tableName, null, itemName, defaultValue); }
private static String getShortIDFromCanonical(String canonicalID) { String shortID = null; String tzidKey = canonicalID.replace('/', ':'); try { // First, try check if the given ID is canonical UResourceBundle keyTypeData = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, "keyTypeData", ICUResourceBundle.ICU_DATA_CLASS_LOADER); UResourceBundle typeMap = keyTypeData.get("typeMap"); UResourceBundle typeKeys = typeMap.get("timezone"); shortID = typeKeys.getString(tzidKey); } catch (MissingResourceException e) { // fall through } return shortID; }
public OlsonTimeZone(String id){ super(id); UResourceBundle top = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, ZONEINFORES, ICUResourceBundle.ICU_DATA_CLASS_LOADER); UResourceBundle res = ZoneMeta.openOlsonResource(top, id); construct(top, res); if (finalZone != null){ finalZone.setID(id); } }
/** * Returns formatting data for all MeasureUnits except for currency ones. */ private static MeasureFormatData loadLocaleData(ULocale locale) { ICUResourceBundle resource = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUData.ICU_UNIT_BASE_NAME, locale); MeasureFormatData cacheData = new MeasureFormatData(); UnitDataSink sink = new UnitDataSink(cacheData); resource.getAllItemsWithFallback("", sink); return cacheData; }
static String loadRules(ULocale locale, String collationType) { UResourceBundle bundle = UResourceBundle.getBundleInstance( ICUData.ICU_COLLATION_BASE_NAME, locale); UResourceBundle data = ((ICUResourceBundle)bundle).getWithFallback( "collations/" + ASCII.toLowerCase(collationType)); String rules = data.getString("Sequence"); return rules; }
/** * Returns the current CLDR version * @stable ICU 4.2 */ public static VersionInfo getCLDRVersion() { // fetching this data should be idempotent. if(gCLDRVersion == null) { // from ZoneMeta.java UResourceBundle supplementalDataBundle = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, "supplementalData", ICUResourceBundle.ICU_DATA_CLASS_LOADER); UResourceBundle cldrVersionBundle = supplementalDataBundle.get("cldrVersion"); gCLDRVersion = VersionInfo.getInstance(cldrVersionBundle.getString()); } return gCLDRVersion; } }
private static NumericFormatters loadNumericFormatters( ULocale locale) { ICUResourceBundle r = (ICUResourceBundle)UResourceBundle. getBundleInstance(ICUData.ICU_UNIT_BASE_NAME, locale); return new NumericFormatters( loadNumericDurationFormat(r, "hm"), loadNumericDurationFormat(r, "ms"), loadNumericDurationFormat(r, "hms")); }
private static GenderInfo load(ULocale ulocale) { UResourceBundle rb = UResourceBundle.getBundleInstance( ICUData.ICU_BASE_NAME, "genderList", ICUResourceBundle.ICU_DATA_CLASS_LOADER, true); UResourceBundle genderList = rb.get("genderList"); try { return new GenderInfo( ListGenderStyle.fromName(genderList.getString(ulocale.toString()))); } catch (MissingResourceException mre) { return null; } } }
private static ListFormatter load(ULocale ulocale, String style) { ICUResourceBundle r = (ICUResourceBundle)UResourceBundle. getBundleInstance(ICUData.ICU_BASE_NAME, ulocale); StringBuilder sb = new StringBuilder(); return new ListFormatter( compilePattern(r.getWithFallback("listPattern/" + style + "/2").getString(), sb), compilePattern(r.getWithFallback("listPattern/" + style + "/start").getString(), sb), compilePattern(r.getWithFallback("listPattern/" + style + "/middle").getString(), sb), compilePattern(r.getWithFallback("listPattern/" + style + "/end").getString(), sb), ulocale); } }
@SuppressWarnings("deprecation") private ListFormatter createListFormatter() { ULocale locale = ULocale.forLanguageTag(this.locale); ICUResourceBundle r = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, locale); String resourceStyle = resourceStyle(); return new ListFormatter(r.getWithFallback("listPattern/" + resourceStyle + "/2").getString(), r.getWithFallback("listPattern/" + resourceStyle + "/start").getString(), r.getWithFallback("listPattern/" + resourceStyle + "/middle").getString(), r.getWithFallback("listPattern/" + resourceStyle + "/end").getString()); }