Java Code Examples for com.ibm.icu.util.ULocale#getName()
The following examples show how to use
com.ibm.icu.util.ULocale#getName() .
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: DayPeriodRules.java From fitnotifications with Apache License 2.0 | 6 votes |
/** * Get a DayPeriodRules object given a locale. * If data hasn't been loaded, it will be loaded for all locales at once. * @param locale locale for which the DayPeriodRules object is requested. * @return a DayPeriodRules object for `locale`. */ public static DayPeriodRules getInstance(ULocale locale) { String localeCode = locale.getName(); if (localeCode.isEmpty()) { localeCode = "root"; } Integer ruleSetNum = null; while (ruleSetNum == null) { ruleSetNum = DATA.localesToRuleSetNumMap.get(localeCode); if (ruleSetNum == null) { localeCode = ULocale.getFallback(localeCode); if (localeCode.isEmpty()) { // Saves a lookup in the map. break; } } else { break; } } if (ruleSetNum == null || DATA.rules[ruleSetNum] == null) { // Data doesn't exist for the locale requested. return null; } return DATA.rules[ruleSetNum]; }
Example 2
Source File: ICULocaleService.java From fitnotifications with Apache License 2.0 | 5 votes |
/** * Create a LocaleKey with canonical primary and fallback IDs. */ public static LocaleKey createWithCanonicalFallback(String primaryID, String canonicalFallbackID, int kind) { if (primaryID == null) { return null; } String canonicalPrimaryID = ULocale.getName(primaryID); return new LocaleKey(primaryID, canonicalPrimaryID, canonicalFallbackID, kind); }
Example 3
Source File: ICULocaleService.java From fitnotifications with Apache License 2.0 | 5 votes |
/** * Create a LocaleKey with canonical primary and fallback IDs. */ public static LocaleKey createWithCanonical(ULocale locale, String canonicalFallbackID, int kind) { if (locale == null) { return null; } String canonicalPrimaryID = locale.getName(); return new LocaleKey(canonicalPrimaryID, canonicalPrimaryID, canonicalFallbackID, kind); }
Example 4
Source File: CollatorServiceShim.java From fitnotifications with Apache License 2.0 | 4 votes |
@Override String getDisplayName(ULocale objectLocale, ULocale displayLocale) { String id = objectLocale.getName(); return service.getDisplayName(id, displayLocale); }
Example 5
Source File: LocaleDisplayNames.java From fitnotifications with Apache License 2.0 | 4 votes |
@Override public String localeDisplayName(ULocale locale) { return locale.getName(); }
Example 6
Source File: LocaleDisplayNames.java From trekarta with GNU General Public License v3.0 | 4 votes |
@Override public String localeDisplayName(ULocale locale) { return locale.getName(); }