本文整理汇总了Java中com.ibm.icu.util.ULocale.ROOT属性的典型用法代码示例。如果您正苦于以下问题:Java ULocale.ROOT属性的具体用法?Java ULocale.ROOT怎么用?Java ULocale.ROOT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.ibm.icu.util.ULocale
的用法示例。
在下文中一共展示了ULocale.ROOT属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createULocaleList
private static final ULocale[] createULocaleList(String baseName,
ClassLoader root) {
// the canned list is a subset of all the available .res files, the idea
// is we don't export them
// all. gotta be a better way to do this, since to add a locale you have
// to update this list,
// and it's embedded in our binary resources.
ICUResourceBundle bundle = (ICUResourceBundle) UResourceBundle.instantiateBundle(baseName, ICU_RESOURCE_INDEX, root, true);
bundle = (ICUResourceBundle)bundle.get(INSTALLED_LOCALES);
int length = bundle.getSize();
int i = 0;
ULocale[] locales = new ULocale[length];
UResourceBundleIterator iter = bundle.getIterator();
iter.reset();
while (iter.hasNext()) {
String locstr = iter.next().getKey();
if (locstr.equals("root")) {
locales[i++] = ULocale.ROOT;
} else {
locales[i++] = new ULocale(locstr);
}
}
bundle = null;
return locales;
}
示例2: getFunctionalEquivalent
/**
* Returns the functionally equivalent locale.
*/
public ULocale getFunctionalEquivalent(ULocale locale, boolean[] isAvailable) {
if (isAvailable != null && isAvailable.length > 0) {
String localeId = ULocale.canonicalize(locale.getBaseName());
Map<String, String> idMap = getLocaleIdToRulesIdMap(PluralType.CARDINAL);
isAvailable[0] = idMap.containsKey(localeId);
}
String rulesId = getRulesIdForLocale(locale, PluralType.CARDINAL);
if (rulesId == null || rulesId.trim().length() == 0) {
return ULocale.ROOT; // ultimate fallback
}
ULocale result = getRulesIdToEquivalentULocaleMap().get(
rulesId);
if (result == null) {
return ULocale.ROOT; // ultimate fallback
}
return result;
}
示例3: makeInstance
private static final Collator makeInstance(ULocale desiredLocale) {
Output<ULocale> validLocale = new Output<ULocale>(ULocale.ROOT);
CollationTailoring t =
CollationLoader.loadTailoring(desiredLocale, validLocale);
return new RuleBasedCollator(t, validLocale.value);
}
示例4: getLocale
ULocale getLocale() {
return ULocale.ROOT;
}
示例5: getULocale
@Override
public ULocale getULocale() {
return ULocale.ROOT;
}
示例6: RuleBasedCollator
/**
* <p>
* Constructor that takes the argument rules for customization.
* The collator will be based on the CLDR root collation, with the
* attributes and re-ordering of the characters specified in the argument rules.
* <p>
* See the User Guide's section on <a href="http://userguide.icu-project.org/collation/customization">
* Collation Customization</a> for details on the rule syntax.
*
* @param rules
* the collation rules to build the collation table from.
* @exception ParseException
* and IOException thrown. ParseException thrown when argument rules have an invalid syntax.
* IOException thrown when an error occurred while reading internal data.
* @stable ICU 2.8
*/
public RuleBasedCollator(String rules) throws Exception {
if (rules == null) {
throw new IllegalArgumentException("Collation rules can not be null");
}
validLocale = ULocale.ROOT;
internalBuildTailoring(rules);
}
示例7: getLocale
/**
* {@icu} Returns the locale that was used to create this object, or null.
* This may may differ from the locale requested at the time of
* this object's creation. For example, if an object is created
* for locale <tt>en_US_CALIFORNIA</tt>, the actual data may be
* drawn from <tt>en</tt> (the <i>actual</i> locale), and
* <tt>en_US</tt> may be the most specific locale that exists (the
* <i>valid</i> locale).
*
* <p>Note: This method will be implemented in ICU 3.0; ICU 2.8
* contains a partial preview implementation. The * <i>actual</i>
* locale is returned correctly, but the <i>valid</i> locale is
* not, in most cases.
*
* <p>The base class method always returns {@link ULocale#ROOT}.
* Subclasses should override it if appropriate.
*
* @param type type of information requested, either {@link
* com.ibm.icu.util.ULocale#VALID_LOCALE} or {@link
* com.ibm.icu.util.ULocale#ACTUAL_LOCALE}.
* @return the information specified by <i>type</i>, or null if
* this object was not constructed from locale data.
* @see com.ibm.icu.util.ULocale
* @see com.ibm.icu.util.ULocale#VALID_LOCALE
* @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE
* @draft ICU 2.8 (retain)
* @provisional This API might change or be removed in a future release.
*/
public ULocale getLocale(ULocale.Type type) {
return ULocale.ROOT;
}