本文整理汇总了Java中com.ibm.icu.util.ULocale.getName方法的典型用法代码示例。如果您正苦于以下问题:Java ULocale.getName方法的具体用法?Java ULocale.getName怎么用?Java ULocale.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ibm.icu.util.ULocale
的用法示例。
在下文中一共展示了ULocale.getName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInstance
import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
/**
* Get a DayPeriodRules object given a locale.
* If data hasn't been loaded, it will be loaded for all locales at once.
* @param locale locale for which the DayPeriodRules object is requested.
* @return a DayPeriodRules object for `locale`.
*/
public static DayPeriodRules getInstance(ULocale locale) {
String localeCode = locale.getName();
if (localeCode.isEmpty()) { localeCode = "root"; }
Integer ruleSetNum = null;
while (ruleSetNum == null) {
ruleSetNum = DATA.localesToRuleSetNumMap.get(localeCode);
if (ruleSetNum == null) {
localeCode = ULocale.getFallback(localeCode);
if (localeCode.isEmpty()) {
// Saves a lookup in the map.
break;
}
} else {
break;
}
}
if (ruleSetNum == null || DATA.rules[ruleSetNum] == null) {
// Data doesn't exist for the locale requested.
return null;
}
return DATA.rules[ruleSetNum];
}
示例2: createWithCanonicalFallback
import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
/**
* Create a LocaleKey with canonical primary and fallback IDs.
*/
public static LocaleKey createWithCanonicalFallback(String primaryID, String canonicalFallbackID, int kind) {
if (primaryID == null) {
return null;
}
String canonicalPrimaryID = ULocale.getName(primaryID);
return new LocaleKey(primaryID, canonicalPrimaryID, canonicalFallbackID, kind);
}
示例3: createWithCanonical
import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
/**
* Create a LocaleKey with canonical primary and fallback IDs.
*/
public static LocaleKey createWithCanonical(ULocale locale, String canonicalFallbackID, int kind) {
if (locale == null) {
return null;
}
String canonicalPrimaryID = locale.getName();
return new LocaleKey(canonicalPrimaryID, canonicalPrimaryID, canonicalFallbackID, kind);
}
示例4: getDisplayName
import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
@Override
String getDisplayName(ULocale objectLocale, ULocale displayLocale) {
String id = objectLocale.getName();
return service.getDisplayName(id, displayLocale);
}
示例5: localeDisplayName
import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
@Override
public String localeDisplayName(ULocale locale) {
return locale.getName();
}