本文整理汇总了Java中com.ibm.icu.util.ULocale.getDisplayName方法的典型用法代码示例。如果您正苦于以下问题:Java ULocale.getDisplayName方法的具体用法?Java ULocale.getDisplayName怎么用?Java ULocale.getDisplayName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ibm.icu.util.ULocale
的用法示例。
在下文中一共展示了ULocale.getDisplayName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDisplayName
import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
/**
* Return the name of the collator for the objectLocale, localized for the displayLocale.
* If objectLocale is not visible or not defined by the factory, return null.
* @param objectLocale the locale identifying the collator
* @param displayLocale the locale for which the display name of the collator should be localized
* @return the display name
* @stable ICU 3.2
*/
public String getDisplayName(ULocale objectLocale, ULocale displayLocale) {
if (visible()) {
Set<String> supported = getSupportedLocaleIDs();
String name = objectLocale.getBaseName();
if (supported.contains(name)) {
return objectLocale.getDisplayName(displayLocale);
}
}
return null;
}
示例2: newRow
import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
private UiListItem newRow(ULocale modified, DisplayContext capContext) {
ULocale minimized = ULocale.minimizeSubtags(modified, ULocale.Minimize.FAVOR_SCRIPT);
String tempName = modified.getDisplayName(locale);
boolean titlecase = capContext == DisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU;
String nameInDisplayLocale = titlecase ? UCharacter.toTitleFirst(locale, tempName) : tempName;
tempName = modified.getDisplayName(modified);
String nameInSelf = capContext == DisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU ? UCharacter.toTitleFirst(modified, tempName) : tempName;
return new UiListItem(minimized, modified, nameInDisplayLocale, nameInSelf);
}
示例3: getDisplayName
import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
/**
* Return a localized name for the locale represented by id.
*/
@Override
public String getDisplayName(String id, ULocale locale) {
// assume if the user called this on us, we must have handled some fallback of this id
// if (isSupportedID(id)) {
if (locale == null) {
return id;
}
ULocale loc = new ULocale(id);
return loc.getDisplayName(locale);
// }
// return null;
}