com.ibm.icu.impl.ICUData Java Examples
The following examples show how to use
com.ibm.icu.impl.ICUData.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CollatorServiceShim.java From fitnotifications with Apache License 2.0 | 6 votes |
CService() { super("Collator"); class CollatorFactory extends ICUResourceBundleFactory { CollatorFactory() { super(ICUData.ICU_COLLATION_BASE_NAME); } @Override protected Object handleCreate(ULocale uloc, int kind, ICUService srvc) { return makeInstance(uloc); } } this.registerFactory(new CollatorFactory()); markDefault(); }
Example #2
Source File: Currency.java From fitnotifications with Apache License 2.0 | 6 votes |
/** * Returns the ISO 4217 numeric code for this currency object. * <p>Note: If the ISO 4217 numeric code is not assigned for the currency or * the currency is unknown, this method returns 0.</p> * @return The ISO 4217 numeric code of this currency. * @stable ICU 49 */ public int getNumericCode() { int result = 0; try { UResourceBundle bundle = UResourceBundle.getBundleInstance( ICUData.ICU_BASE_NAME, "currencyNumericCodes", ICUResourceBundle.ICU_DATA_CLASS_LOADER); UResourceBundle codeMap = bundle.get("codeMap"); UResourceBundle numCode = codeMap.get(subType); result = numCode.getInt(); } catch (MissingResourceException e) { // fall through } return result; }
Example #3
Source File: NumberingSystem.java From fitnotifications with Apache License 2.0 | 6 votes |
private static NumberingSystem lookupInstanceByName(String name) { int radix; boolean isAlgorithmic; String description; try { UResourceBundle numberingSystemsInfo = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, "numberingSystems"); UResourceBundle nsCurrent = numberingSystemsInfo.get("numberingSystems"); UResourceBundle nsTop = nsCurrent.get(name); description = nsTop.getString("desc"); UResourceBundle nsRadixBundle = nsTop.get("radix"); UResourceBundle nsAlgBundle = nsTop.get("algorithmic"); radix = nsRadixBundle.getInt(); int algorithmic = nsAlgBundle.getInt(); isAlgorithmic = ( algorithmic == 1 ); } catch (MissingResourceException ex) { return null; } return getInstance(name, radix, isAlgorithmic, description); }
Example #4
Source File: NumberingSystem.java From fitnotifications with Apache License 2.0 | 6 votes |
/** * Returns a string array containing a list of the names of numbering systems * currently known to ICU. * @stable ICU 4.2 */ public static String [] getAvailableNames() { UResourceBundle numberingSystemsInfo = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, "numberingSystems"); UResourceBundle nsCurrent = numberingSystemsInfo.get("numberingSystems"); UResourceBundle temp; String nsName; ArrayList<String> output = new ArrayList<String>(); UResourceBundleIterator it = nsCurrent.getIterator(); while (it.hasNext()) { temp = it.next(); nsName = temp.getKey(); output.add(nsName); } return output.toArray(new String[output.size()]); }
Example #5
Source File: ResourceReader.java From fitnotifications with Apache License 2.0 | 6 votes |
/** * Reset to the start by reconstructing the stream and readers. * We could also use mark() and reset() on the stream or reader, * but that would cause them to keep the stream data around in * memory. We don't want that because some of the resource files * are large, e.g., 400k. */ private void _reset() throws UnsupportedEncodingException { try { close(); } catch (IOException e) {} if (lineNo == 0) { return; } InputStream is = ICUData.getStream(root, resourceName); if (is == null) { throw new IllegalArgumentException("Can't open " + resourceName); } InputStreamReader isr = (encoding == null) ? new InputStreamReader(is) : new InputStreamReader(is, encoding); reader = new BufferedReader(isr); lineNo = 0; }
Example #6
Source File: CollationLoader.java From fitnotifications with Apache License 2.0 | 5 votes |
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; }
Example #7
Source File: LocaleMatcher.java From fitnotifications with Apache License 2.0 | 5 votes |
/** * @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; }
Example #8
Source File: CollatorServiceShim.java From fitnotifications with Apache License 2.0 | 5 votes |
@Override Locale[] getAvailableLocales() { // TODO rewrite this to just wrap getAvailableULocales later Locale[] result; if (service.isDefault()) { result = ICUResourceBundle.getAvailableLocales(ICUData.ICU_COLLATION_BASE_NAME, ICUResourceBundle.ICU_DATA_CLASS_LOADER); } else { result = service.getAvailableLocales(); } return result; }
Example #9
Source File: MeasureUnit.java From fitnotifications with Apache License 2.0 | 5 votes |
/** * Populate the MeasureUnit cache with all types from the data. * Population is done lazily, in response to MeasureUnit.getAvailable() * or other API that expects to see all of the MeasureUnits. * * <p>At static initialization time the MeasureUnits cache is populated * with public static instances (G_FORCE, METER_PER_SECOND_SQUARED, etc.) only. * Adding of others is deferred until later to avoid circular static init * dependencies with classes Currency and TimeUnit. * * <p>Synchronization: this function must be called from static synchronized methods only. * * @internal */ static private void populateCache() { if (cacheIsPopulated) { return; } cacheIsPopulated = true; /* Schema: * * units{ * duration{ * day{ * one{"{0} ден"} * other{"{0} дена"} * } */ // Load the unit types. Use English, since we know that that is a superset. ICUResourceBundle rb1 = (ICUResourceBundle) UResourceBundle.getBundleInstance( ICUData.ICU_UNIT_BASE_NAME, "en"); rb1.getAllItemsWithFallback("units", new MeasureUnitSink()); // Load the currencies ICUResourceBundle rb2 = (ICUResourceBundle) UResourceBundle.getBundleInstance( ICUData.ICU_BASE_NAME, "currencyNumericCodes", ICUResourceBundle.ICU_DATA_CLASS_LOADER); rb2.getAllItemsWithFallback("codeMap", new CurrencyNumericCodeSink()); }
Example #10
Source File: TimeZone.java From fitnotifications with Apache License 2.0 | 5 votes |
/** * {@icu} Converts a system time zone ID to an equivalent Windows time zone ID. For example, * Windows time zone ID "Pacific Standard Time" is returned for input "America/Los_Angeles". * * <p>There are system time zones that cannot be mapped to Windows zones. When the input * system time zone ID is unknown or unmappable to a Windows time zone, then this * method returns <code>null</code>. * * <p>This implementation utilizes <a href="http://unicode.org/cldr/charts/supplemental/zone_tzid.html"> * Zone-Tzid mapping data</a>. The mapping data is updated time to time. To get the latest changes, * please read the ICU user guide section <a href="http://userguide.icu-project.org/datetime/timezone#TOC-Updating-the-Time-Zone-Data"> * Updating the Time Zone Data</a>. * * @param id A system time zone ID * @return A Windows time zone ID mapped from the input system time zone ID, * or <code>null</code> when the input ID is unknown or unmappable. * @see #getIDForWindowsID(String, String) * * @stable ICU 52 */ public static String getWindowsID(String id) { // canonicalize the input ID boolean[] isSystemID = {false}; id = getCanonicalID(id, isSystemID); if (!isSystemID[0]) { // mapping data is only applicable to tz database IDs return null; } UResourceBundle top = UResourceBundle.getBundleInstance( ICUData.ICU_BASE_NAME, "windowsZones", ICUResourceBundle.ICU_DATA_CLASS_LOADER); UResourceBundle mapTimezones = top.get("mapTimezones"); UResourceBundleIterator resitr = mapTimezones.getIterator(); while (resitr.hasNext()) { UResourceBundle winzone = resitr.next(); if (winzone.getType() != UResourceBundle.TABLE) { continue; } UResourceBundleIterator rgitr = winzone.getIterator(); while (rgitr.hasNext()) { UResourceBundle regionalData = rgitr.next(); if (regionalData.getType() != UResourceBundle.STRING) { continue; } String[] tzids = regionalData.getString().split(" "); for (String tzid : tzids) { if (tzid.equals(id)) { return winzone.getKey(); } } } } return null; }
Example #11
Source File: LocaleData.java From fitnotifications with Apache License 2.0 | 5 votes |
/** * 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; }
Example #12
Source File: LocaleData.java From fitnotifications with Apache License 2.0 | 5 votes |
/** * 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; }
Example #13
Source File: ULocale.java From fitnotifications with Apache License 2.0 | 5 votes |
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; } }
Example #14
Source File: ResourceBasedPeriodFormatterDataService.java From fitnotifications with Apache License 2.0 | 5 votes |
/** * Constructs the service. */ private ResourceBasedPeriodFormatterDataService() { List<String> localeNames = new ArrayList<String>(); // of String InputStream is = ICUData.getRequiredStream(getClass(), PATH + "index.txt"); try { BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8")); String string = null; while (null != (string = br.readLine())) { string = string.trim(); if (string.startsWith("#") || string.length() == 0) { continue; } localeNames.add(string); } br.close(); } catch (IOException e) { throw new IllegalStateException("IO Error reading " + PATH + "index.txt: " + e.toString()); } finally { try { is.close(); } catch (IOException ignored) { } } availableLocales = Collections.unmodifiableList(localeNames); }
Example #15
Source File: CollationLoader.java From fitnotifications with Apache License 2.0 | 5 votes |
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"); } } }
Example #16
Source File: GenderInfo.java From fitnotifications with Apache License 2.0 | 5 votes |
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; } }
Example #17
Source File: UResourceBundle.java From trekarta with GNU General Public License v3.0 | 5 votes |
/** * {@icu} Creates a UResourceBundle for the default locale and specified base name, * from which users can extract resources by using their corresponding keys. * @param baseName string containing the name of the data package. * If null the default ICU package name is used. * @return a resource bundle for the given base name and default locale * @stable ICU 3.0 */ public static UResourceBundle getBundleInstance(String baseName) { if (baseName == null) { baseName = ICUData.ICU_BASE_NAME; } ULocale uloc = ULocale.getDefault(); return getBundleInstance(baseName, uloc.getBaseName(), ICUResourceBundle.ICU_DATA_CLASS_LOADER, false); }
Example #18
Source File: UResourceBundle.java From trekarta with GNU General Public License v3.0 | 5 votes |
/** * {@icu} Creates a UResourceBundle for the specified locale and specified base name, * from which users can extract resources by using their corresponding keys. * @param baseName string containing the name of the data package. * If null the default ICU package name is used. * @param locale specifies the locale for which we want to open the resource. * If null the bundle for default locale is opened. * @return a resource bundle for the given base name and locale * @stable ICU 3.0 */ public static UResourceBundle getBundleInstance(String baseName, Locale locale) { if (baseName == null) { baseName = ICUData.ICU_BASE_NAME; } ULocale uloc = locale == null ? ULocale.getDefault() : ULocale.forLocale(locale); return getBundleInstance(baseName, uloc.getBaseName(), ICUResourceBundle.ICU_DATA_CLASS_LOADER, false); }
Example #19
Source File: UResourceBundle.java From trekarta with GNU General Public License v3.0 | 5 votes |
/** * {@icu} Creates a UResourceBundle, from which users can extract resources by using * their corresponding keys. * @param baseName string containing the name of the data package. * If null the default ICU package name is used. * @param locale specifies the locale for which we want to open the resource. * If null the bundle for default locale is opened. * @return a resource bundle for the given base name and locale * @stable ICU 3.0 */ public static UResourceBundle getBundleInstance(String baseName, ULocale locale) { if (baseName == null) { baseName = ICUData.ICU_BASE_NAME; } if (locale == null) { locale = ULocale.getDefault(); } return getBundleInstance(baseName, locale.getBaseName(), ICUResourceBundle.ICU_DATA_CLASS_LOADER, false); }
Example #20
Source File: LocaleData.java From trekarta with GNU General Public License v3.0 | 5 votes |
/** * 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; }
Example #21
Source File: LocaleData.java From trekarta with GNU General Public License v3.0 | 5 votes |
/** * 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; }
Example #22
Source File: ULocale.java From trekarta with GNU General Public License v3.0 | 5 votes |
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; } }
Example #23
Source File: LocaleDistance.java From trekarta with GNU General Public License v3.0 | 5 votes |
public static Data load() throws MissingResourceException { ICUResourceBundle langInfo = ICUResourceBundle.getBundleInstance( ICUData.ICU_BASE_NAME, "langInfo", ICUResourceBundle.ICU_DATA_CLASS_LOADER, ICUResourceBundle.OpenType.DIRECT); UResource.Value value = langInfo.getValueWithFallback("match"); UResource.Table matchTable = value.getTable(); ByteBuffer buffer = getValue(matchTable, "trie", value).getBinary(); byte[] trie = new byte[buffer.remaining()]; buffer.get(trie); buffer = getValue(matchTable, "regionToPartitions", value).getBinary(); byte[] regionToPartitions = new byte[buffer.remaining()]; buffer.get(regionToPartitions); if (regionToPartitions.length < LSR.REGION_INDEX_LIMIT) { throw new MissingResourceException( "langInfo.res binary data too short", "", "match/regionToPartitions"); } String[] partitions = getValue(matchTable, "partitions", value).getStringArray(); Set<LSR> paradigmLSRs; if (matchTable.findValue("paradigms", value)) { String[] paradigms = value.getStringArray(); paradigmLSRs = new HashSet<>(paradigms.length / 3); for (int i = 0; i < paradigms.length; i += 3) { paradigmLSRs.add(new LSR(paradigms[i], paradigms[i + 1], paradigms[i + 2])); } } else { paradigmLSRs = Collections.emptySet(); } int[] distances = getValue(matchTable, "distances", value).getIntVector(); if (distances.length < IX_LIMIT) { throw new MissingResourceException( "langInfo.res intvector too short", "", "match/distances"); } return new Data(trie, regionToPartitions, partitions, paradigmLSRs, distances); }
Example #24
Source File: ListFormatObject.java From es6draft with MIT License | 5 votes |
@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()); }
Example #25
Source File: SimpleDateFormat.java From fitnotifications with Apache License 2.0 | 5 votes |
private static synchronized String getDefaultPattern() { ULocale defaultLocale = ULocale.getDefault(Category.FORMAT); if (!defaultLocale.equals(cachedDefaultLocale)) { cachedDefaultLocale = defaultLocale; Calendar cal = Calendar.getInstance(cachedDefaultLocale); try { // Load the calendar data directly. ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance( ICUData.ICU_BASE_NAME, cachedDefaultLocale); String resourcePath = "calendar/" + cal.getType() + "/DateTimePatterns"; ICUResourceBundle patternsRb= rb.findWithFallback(resourcePath); if (patternsRb == null) { patternsRb = rb.findWithFallback("calendar/gregorian/DateTimePatterns"); } if (patternsRb == null || patternsRb.getSize() < 9) { cachedDefaultPattern = FALLBACKPATTERN; } else { int defaultIndex = 8; if (patternsRb.getSize() >= 13) { defaultIndex += (SHORT + 1); } String basePattern = patternsRb.getString(defaultIndex); cachedDefaultPattern = SimpleFormatterImpl.formatRawPattern( basePattern, 2, 2, patternsRb.getString(SHORT), patternsRb.getString(SHORT + 4)); } } catch (MissingResourceException e) { cachedDefaultPattern = FALLBACKPATTERN; } } return cachedDefaultPattern; }
Example #26
Source File: RuleBasedNumberFormat.java From fitnotifications with Apache License 2.0 | 5 votes |
/** * Set capitalizationForListOrMenu, capitalizationForStandAlone */ private void initCapitalizationContextInfo(ULocale theLocale) { ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, theLocale); try { ICUResourceBundle rdb = rb.getWithFallback("contextTransforms/number-spellout"); int[] intVector = rdb.getIntVector(); if (intVector.length >= 2) { capitalizationForListOrMenu = (intVector[0] != 0); capitalizationForStandAlone = (intVector[1] != 0); } } catch (MissingResourceException e) { // use default } }
Example #27
Source File: UResourceBundle.java From fitnotifications with Apache License 2.0 | 5 votes |
/** * {@icu} Creates a UResourceBundle, from which users can extract resources by using * their corresponding keys. * @param baseName string containing the name of the data package. * If null the default ICU package name is used. * @param locale specifies the locale for which we want to open the resource. * If null the bundle for default locale is opened. * @return a resource bundle for the given base name and locale * @stable ICU 3.0 */ public static UResourceBundle getBundleInstance(String baseName, ULocale locale) { if (baseName == null) { baseName = ICUData.ICU_BASE_NAME; } if (locale == null) { locale = ULocale.getDefault(); } return getBundleInstance(baseName, locale.getBaseName(), ICUResourceBundle.ICU_DATA_CLASS_LOADER, false); }
Example #28
Source File: DateIntervalFormat.java From fitnotifications with Apache License 2.0 | 5 votes |
/** * Retrieves the concatenation DateTime pattern from the resource bundle. * @param locale Locale to retrieve. * @return Concatenation DateTime pattern. */ private String getConcatenationPattern(ULocale locale) { ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, locale); ICUResourceBundle dtPatternsRb = rb.getWithFallback("calendar/gregorian/DateTimePatterns"); ICUResourceBundle concatenationPatternRb = (ICUResourceBundle) dtPatternsRb.get(8); if (concatenationPatternRb.getType() == UResourceBundle.STRING) { return concatenationPatternRb.getString(); } else { return concatenationPatternRb.getString(0); } }
Example #29
Source File: RuleBasedNumberFormat.java From fitnotifications with Apache License 2.0 | 5 votes |
/** * Creates a RuleBasedNumberFormat from a predefined description. The selector * code chooses among three possible predefined formats: spellout, ordinal, * and duration. * @param locale The locale for the formatter. * @param format A selector code specifying which kind of formatter to create for that * locale. There are four legal values: SPELLOUT, which creates a formatter that * spells out a value in words in the desired language, ORDINAL, which attaches * an ordinal suffix from the desired language to the end of a number (e.g. "123rd"), * DURATION, which formats a duration in seconds as hours, minutes, and seconds, and * NUMBERING_SYSTEM, which is used to invoke rules for alternate numbering * systems such as the Hebrew numbering system, or for Roman numerals, etc.. * @stable ICU 3.2 */ public RuleBasedNumberFormat(ULocale locale, int format) { this.locale = locale; ICUResourceBundle bundle = (ICUResourceBundle)UResourceBundle. getBundleInstance(ICUData.ICU_RBNF_BASE_NAME, locale); // TODO: determine correct actual/valid locale. Note ambiguity // here -- do actual/valid refer to pattern, DecimalFormatSymbols, // or Collator? ULocale uloc = bundle.getULocale(); setLocale(uloc, uloc); StringBuilder description = new StringBuilder(); String[][] localizations = null; try { ICUResourceBundle rules = bundle.getWithFallback("RBNFRules/"+rulenames[format-1]); UResourceBundleIterator it = rules.getIterator(); while (it.hasNext()) { description.append(it.nextString()); } } catch (MissingResourceException e1) { } // We use findTopLevel() instead of get() because // it's faster when we know that it's usually going to fail. UResourceBundle locNamesBundle = bundle.findTopLevel(locnames[format - 1]); if (locNamesBundle != null) { localizations = new String[locNamesBundle.getSize()][]; for (int i = 0; i < localizations.length; ++i) { localizations[i] = locNamesBundle.get(i).getStringArray(); } } // else there are no localized names. It's not that important. init(description.toString(), localizations); }
Example #30
Source File: ListFormatter.java From fitnotifications with Apache License 2.0 | 5 votes |
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); }