本文整理汇总了Java中sun.util.locale.provider.LocaleServiceProviderPool.getLocalizedObject方法的典型用法代码示例。如果您正苦于以下问题:Java LocaleServiceProviderPool.getLocalizedObject方法的具体用法?Java LocaleServiceProviderPool.getLocalizedObject怎么用?Java LocaleServiceProviderPool.getLocalizedObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.util.locale.provider.LocaleServiceProviderPool
的用法示例。
在下文中一共展示了LocaleServiceProviderPool.getLocalizedObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDisplayString
import sun.util.locale.provider.LocaleServiceProviderPool; //导入方法依赖的package包/类
private String getDisplayString(String code, Locale inLocale, int type) {
if (code.length() == 0) {
return "";
}
if (inLocale == null) {
throw new NullPointerException();
}
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(LocaleNameProvider.class);
String key = (type == DISPLAY_VARIANT ? "%%"+code : code);
String result = pool.getLocalizedObject(
LocaleNameGetter.INSTANCE,
inLocale, key, type, code);
if (result != null) {
return result;
}
return code;
}
示例2: getSymbol
import sun.util.locale.provider.LocaleServiceProviderPool; //导入方法依赖的package包/类
/**
* Gets the symbol of this currency for the specified locale.
* For example, for the US Dollar, the symbol is "$" if the specified
* locale is the US, while for other locales it may be "US$". If no
* symbol can be determined, the ISO 4217 currency code is returned.
*
* @param locale the locale for which a display name for this currency is
* needed
* @return the symbol of this currency for the specified locale
* @exception NullPointerException if <code>locale</code> is null
*/
public String getSymbol(Locale locale) {
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(CurrencyNameProvider.class);
String symbol = pool.getLocalizedObject(
CurrencyNameGetter.INSTANCE,
locale, currencyCode, SYMBOL);
if (symbol != null) {
return symbol;
}
// use currency code as symbol of last resort
return currencyCode;
}
示例3: getDisplayName
import sun.util.locale.provider.LocaleServiceProviderPool; //导入方法依赖的package包/类
/**
* Gets the name that is suitable for displaying this currency for
* the specified locale. If there is no suitable display name found
* for the specified locale, the ISO 4217 currency code is returned.
*
* @param locale the locale for which a display name for this currency is
* needed
* @return the display name of this currency for the specified locale
* @exception NullPointerException if <code>locale</code> is null
* @since 1.7
*/
public String getDisplayName(Locale locale) {
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(CurrencyNameProvider.class);
String result = pool.getLocalizedObject(
CurrencyNameGetter.INSTANCE,
locale, currencyCode, DISPLAYNAME);
if (result != null) {
return result;
}
// use currency code as symbol of last resort
return currencyCode;
}