本文整理了Java中java.util.Locale.getDisplayLanguage()
方法的一些代码示例,展示了Locale.getDisplayLanguage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Locale.getDisplayLanguage()
方法的具体详情如下:
包路径:java.util.Locale
类名称:Locale
方法名:getDisplayLanguage
[英]Equivalent to getDisplayLanguage(Locale.getDefault()).
[中]等效于getDisplayLanguage(Locale.getDefault())。
代码示例来源:origin: google/ExoPlayer
private String buildLanguageString(String language) {
Locale locale = Util.SDK_INT >= 21 ? Locale.forLanguageTag(language) : new Locale(language);
return locale.getDisplayLanguage();
}
代码示例来源:origin: robovm/robovm
/**
* Equivalent to {@code getDisplayLanguage(Locale.getDefault())}.
*/
public final String getDisplayLanguage() {
return getDisplayLanguage(getDefault());
}
代码示例来源:origin: remkop/picocli
@Override
public void run() {
for (String code : languageCodes) {
System.out.println(String.format("%s: %s", code.toLowerCase(), new Locale(code).getDisplayLanguage()));
}
}
}
代码示例来源:origin: ankidroid/Anki-Android
public LanguageListerBeolingus() {
super();
addLanguage((new Locale("eng")).getDisplayLanguage() , "en-de");
addLanguage((new Locale("deu")).getDisplayLanguage(), "deen");
addLanguage((new Locale("spa")).getDisplayLanguage(), "es-de");
addLanguage((new Locale("por")).getDisplayLanguage(), "pt-de");
}
代码示例来源:origin: com.h2database/h2
/**
* Get the collation name.
*
* @param l the locale
* @return the name of the collation
*/
public static String getName(Locale l) {
Locale english = Locale.ENGLISH;
String name = l.getDisplayLanguage(english) + ' ' +
l.getDisplayCountry(english) + ' ' + l.getVariant();
name = StringUtils.toUpperEnglish(name.trim().replace(' ', '_'));
return name;
}
代码示例来源:origin: sannies/mp4parser
public String getLanguageString() {
String lang = language.get("" + dataLanguage);
if (lang == null) {
ByteBuffer b = ByteBuffer.wrap(new byte[2]);
IsoTypeWriter.writeUInt16(b, dataLanguage);
b.reset();
return new Locale(IsoTypeReader.readIso639(b)).getDisplayLanguage();
} else {
return lang;
}
}
代码示例来源:origin: lealone/Lealone
/**
* Get the collation name.
*
* @param l the locale
* @return the name of the collation
*/
public static String getName(Locale l) {
Locale english = Locale.ENGLISH;
String name = l.getDisplayLanguage(english) + ' ' + l.getDisplayCountry(english) + ' ' + l.getVariant();
name = StringUtils.toUpperEnglish(name.trim().replace(' ', '_'));
return name;
}
代码示例来源:origin: ankidroid/Anki-Android
public LanguagesListerGlosbe() {
final String [] languages ={"eng", "deu", "jpn", "fra", "spa", "pol", "ita", "rus",
"ces", "zho", "nld", "por", "swe", "hrv", "hin", "hun", "vie", "ara", "tur"};
// Java Locale uses ISO 639-2 rather than 639-3 so we currently only support the subset of
// the languages on Glosbe which are in ISO 639-2. "Chinese Mandarin" ("cmn") for example
// is not supported, but "Chinese" ("zho") is.
for (String l : languages) {
Locale locale = new Locale(l);
addLanguage(locale.getDisplayLanguage(), locale.getISO3Language());
}
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg(value = "locale", nativeType = WrapLocale.class, optional = @Optional("null")))
public Memory getDisplayLanguage(Environment env, Memory... args) {
return StringMemory.valueOf(args[0].isNull()
? locale.getDisplayLanguage()
: locale.getDisplayLanguage(args[0].toObject(WrapLocale.class).locale)
);
}
代码示例来源:origin: robovm/robovm
StringBuilder buffer = new StringBuilder();
if (!languageCode.isEmpty()) {
String displayLanguage = getDisplayLanguage(locale);
buffer.append(displayLanguage.isEmpty() ? languageCode : displayLanguage);
++count;
代码示例来源:origin: stackoverflow.com
System.out.println(" default.locale = "
+ defaultLocale.getLanguage() + "_" + defaultLocale.getCountry()
+ " (" + defaultLocale.getDisplayLanguage()
+ "," + defaultLocale.getDisplayCountry() + ")");
System.out.println(" now = " + nowInMillis + " [ms] or "
代码示例来源:origin: stackoverflow.com
suffix,
prefix +
locale.getDisplayLanguage() +
suffix +
"</td><td>" +
代码示例来源:origin: spring-projects/spring-framework
assertEquals("AT node not selected.", "selected", e.attribute("selected").getValue());
assertEquals("AT Locale displayLanguage property not used for option label.",
LOCALE_AT.getDisplayLanguage(), e.getData());
assertEquals("US node not selected.", "selected", e.attribute("selected").getValue());
assertEquals("US Locale displayLanguage property not used for option label.",
Locale.US.getDisplayLanguage(), e.getData());
代码示例来源:origin: stackoverflow.com
Locale uiLocale = Locale.getDefault(Locale.Category.DISPLAY);
String languageName = uiLocale.getDisplayLanguage(uiLocale);
String countryName = uiLocale.getDisplayLanguage(uiLocale);
// usually something like langage (country), i.e. polski (Polska)
String localeName = uiLocale.getDisplayName(uiLocale);
代码示例来源:origin: pentaho/mondrian
public int compare(Object lhs, Object rhs) {
String ls = ((Locale) lhs).getDisplayLanguage();
String rs = ((Locale) rhs).getDisplayLanguage();
// TODO: this is not very nice - We should introduce a
// MyLocale
if (ls.equals("pap")) {
ls = "Papiamentu";
}
if (rs.equals("pap")) {
rs = "Papiamentu";
}
return ls.compareTo(rs);
}
});
代码示例来源:origin: gzu-liyujiang/AndroidPicker
public void onConstellationPicker(View view) {
boolean isChinese = Locale.getDefault().getDisplayLanguage().contains("中文");
OptionPicker picker = new OptionPicker(this,
isChinese ? new String[]{
代码示例来源:origin: torakiki/pdfsam
private void refreshBundles() {
LOG.trace("Loading i18n bundle for {}", Locale.getDefault());
this.i18n = I18nFactory.getI18n(DefaultI18nContext.class);
LOG.debug("Locale set to {}", Locale.getDefault().getDisplayLanguage());
}
代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel
private Map<String, String> _getISOLanguages(Locale locale) {
Map<String, String> isoLanguages = new TreeMap<>(
String.CASE_INSENSITIVE_ORDER);
for (String isoLanguageId : Locale.getISOLanguages()) {
Locale isoLocale = _fromLanguageId(isoLanguageId, true);
isoLanguages.put(
isoLocale.getDisplayLanguage(locale), isoLanguageId);
}
return isoLanguages;
}
代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel
private String _getShortDisplayName(
Locale locale, Set<String> duplicateLanguages) {
String language = locale.getDisplayLanguage(locale);
if (language.length() > 3) {
language = locale.getLanguage();
language = StringUtil.toUpperCase(language);
}
String country = locale.getCountry();
return _getDisplayName(
language, StringUtil.toUpperCase(country), locale,
duplicateLanguages);
}
代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel
private String _getLongDisplayName(
Locale locale, Set<String> duplicateLanguages) {
return _getDisplayName(
locale.getDisplayLanguage(locale), locale.getDisplayCountry(locale),
locale, duplicateLanguages);
}
内容来源于网络,如有侵权,请联系作者删除!