Java Code Examples for com.ibm.icu.util.ULocale#getDisplayName()

The following examples show how to use com.ibm.icu.util.ULocale#getDisplayName() . 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: Collator.java    From fitnotifications with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source File: LocaleDisplayNamesImpl.java    From fitnotifications with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 3
Source File: ICULocaleService.java    From fitnotifications with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: FormatAdapter.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public static String getLocaleDisplayName( ULocale locale )
{
	if ( locale == null )
		return NONE;
	else
		return locale.getDisplayName( );
}