本文整理汇总了Java中sun.util.locale.provider.JRELocaleProviderAdapter类的典型用法代码示例。如果您正苦于以下问题:Java JRELocaleProviderAdapter类的具体用法?Java JRELocaleProviderAdapter怎么用?Java JRELocaleProviderAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JRELocaleProviderAdapter类属于sun.util.locale.provider包,在下文中一共展示了JRELocaleProviderAdapter类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getCandidateLocales
import sun.util.locale.provider.JRELocaleProviderAdapter; //导入依赖的package包/类
@Override
public List<Locale> getCandidateLocales(String baseName, Locale locale) {
List<Locale> candidates = super.getCandidateLocales(baseName, locale);
// Weed out Locales which are known to have no resource bundles
int lastDot = baseName.lastIndexOf('.');
String category = (lastDot >= 0) ? baseName.substring(lastDot + 1) : baseName;
LocaleProviderAdapter.Type type = baseName.contains(DOTCLDR) ? CLDR : JRE;
LocaleProviderAdapter adapter = LocaleProviderAdapter.forType(type);
Set<String> langtags = ((JRELocaleProviderAdapter)adapter).getLanguageTagSet(category);
if (!langtags.isEmpty()) {
for (Iterator<Locale> itr = candidates.iterator(); itr.hasNext();) {
if (!LocaleProviderAdapter.isSupportedLocale(itr.next(), type, langtags)) {
itr.remove();
}
}
}
// Force fallback to Locale.ENGLISH for CLDR time zone names support
if (locale.getLanguage() != "en"
&& type == CLDR && category.equals("TimeZoneNames")) {
candidates.add(candidates.size() - 1, Locale.ENGLISH);
}
return candidates;
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:LocaleData.java
示例2: getCandidateLocales
import sun.util.locale.provider.JRELocaleProviderAdapter; //导入依赖的package包/类
@Override
public List<Locale> getCandidateLocales(String baseName, Locale locale) {
String key = baseName + '-' + locale.toLanguageTag();
List<Locale> candidates = CANDIDATES_MAP.get(key);
if (candidates == null) {
LocaleProviderAdapter.Type type = baseName.contains(DOTCLDR) ? CLDR : JRE;
LocaleProviderAdapter adapter = LocaleProviderAdapter.forType(type);
candidates = adapter instanceof ResourceBundleBasedAdapter ?
((ResourceBundleBasedAdapter)adapter).getCandidateLocales(baseName, locale) :
defaultControl.getCandidateLocales(baseName, locale);
// Weed out Locales which are known to have no resource bundles
int lastDot = baseName.lastIndexOf('.');
String category = (lastDot >= 0) ? baseName.substring(lastDot + 1) : baseName;
Set<String> langtags = ((JRELocaleProviderAdapter)adapter).getLanguageTagSet(category);
if (!langtags.isEmpty()) {
for (Iterator<Locale> itr = candidates.iterator(); itr.hasNext();) {
if (!adapter.isSupportedProviderLocale(itr.next(), langtags)) {
itr.remove();
}
}
}
// Force fallback to Locale.ENGLISH for CLDR time zone names support
if (locale.getLanguage() != "en"
&& type == CLDR && category.equals("TimeZoneNames")) {
candidates.add(candidates.size() - 1, Locale.ENGLISH);
}
CANDIDATES_MAP.putIfAbsent(key, candidates);
}
return candidates;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:LocaleData.java
注:本文中的sun.util.locale.provider.JRELocaleProviderAdapter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论