Java Code Examples for android.icu.text.DisplayContext#LENGTH_SHORT
The following examples show how to use
android.icu.text.DisplayContext#LENGTH_SHORT .
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: LocaleDisplayNamesImpl.java From j2objc with Apache License 2.0 | 6 votes |
private String keyValueDisplayName(String key, String value, boolean skipAdjust) { String keyValueName = null; if (key.equals("currency")) { keyValueName = currencyDisplayInfo.getName(AsciiUtil.toUpperString(value)); if (keyValueName == null) { keyValueName = value; } } else { if (nameLength == DisplayContext.LENGTH_SHORT) { String tmp = langData.get("Types%short", key, value); if (tmp != null && !tmp.equals(value)) { keyValueName = tmp; } } if (keyValueName == null) { keyValueName = langData.get("Types", key, value); } } return skipAdjust? keyValueName: adjustForUsageAndContext(CapitalizationContextUsage.KEYVALUE, keyValueName); }
Example 2
Source File: LocaleDisplayNamesImpl.java From j2objc with Apache License 2.0 | 5 votes |
private String localeIdName(String localeId) { if (nameLength == DisplayContext.LENGTH_SHORT) { String locIdName = langData.get("Languages%short", localeId); if (locIdName != null && !locIdName.equals(localeId)) { return locIdName; } } return langData.get("Languages", localeId); }
Example 3
Source File: LocaleDisplayNamesImpl.java From j2objc with Apache License 2.0 | 5 votes |
@Override public String languageDisplayName(String lang) { // Special case to eliminate non-languages, which pollute our data. if (lang.equals("root") || lang.indexOf('_') != -1) { return substituteHandling == DisplayContext.SUBSTITUTE ? lang : null; } if (nameLength == DisplayContext.LENGTH_SHORT) { String langName = langData.get("Languages%short", lang); if (langName != null && !langName.equals(lang)) { return adjustForUsageAndContext(CapitalizationContextUsage.LANGUAGE, langName); } } return adjustForUsageAndContext(CapitalizationContextUsage.LANGUAGE, langData.get("Languages", lang)); }
Example 4
Source File: LocaleDisplayNamesImpl.java From j2objc with Apache License 2.0 | 5 votes |
@Override public String scriptDisplayName(String script) { String str = langData.get("Scripts%stand-alone", script); if (str == null || str.equals(script)) { if (nameLength == DisplayContext.LENGTH_SHORT) { str = langData.get("Scripts%short", script); if (str != null && !str.equals(script)) { return adjustForUsageAndContext(CapitalizationContextUsage.SCRIPT, str); } } str = langData.get("Scripts", script); } return adjustForUsageAndContext(CapitalizationContextUsage.SCRIPT, str); }