/** * {@icu} Returns the (normalized) base name for this locale. * @return the base name as a String. * @stable ICU 3.0 */ public String getBaseName() { return getBaseName(localeID); }
public SimpleLocaleKeyFactory(Object obj, ULocale locale, int kind, boolean visible, String name) { super(visible, name); this.obj = obj; this.id = locale.getBaseName(); this.kind = kind; }
/** * {@icu} Returns the (normalized) base name for this locale. * @return the base name as a String. * @stable ICU 3.0 */ public String getBaseName() { return getBaseName(localeID); }
/** * {@icu} Returns the (normalized) base name for this locale, * like {@link #getName()}, but without keywords. * * @return the base name as a String. * @stable ICU 3.0 */ public String getBaseName() { return getBaseName(localeID); }
/** * Constructs a SimpleNumberFormatFactory with the given locale and the * visibility. * @stable ICU 3.2 */ public SimpleNumberFormatFactory(ULocale locale, boolean visible) { localeNames = Collections.singleton(locale.getBaseName()); this.visible = visible; }
public ICUDataTable(String path, ULocale locale, boolean nullIfNotFound) { super(nullIfNotFound); this.bundle = (ICUResourceBundle) UResourceBundle.getBundleInstance( path, locale.getBaseName()); }
/** * Constructs a SimpleNumberFormatFactory with the given locale and the * visibility. * @stable ICU 2.6 */ public SimpleNumberFormatFactory(Locale locale, boolean visible) { localeNames = Collections.singleton(ULocale.forLocale(locale).getBaseName()); this.visible = visible; }
Translation getTranslationWithFallBack(Key loadedKey, List<ULocale> localeIterator) { Translation translation = null; for (ULocale uLocale : localeIterator) { translation = loadedKey.getTranslation(uLocale.getBaseName()); if (translation != null) { break; } } return translation; }
/** * The factory method of <code>TimeZoneGenericNames</code>. This static method * returns a frozen instance of cached <code>TimeZoneGenericNames</code>. * @param locale the locale * @return A frozen <code>TimeZoneGenericNames</code>. */ public static TimeZoneGenericNames getInstance(ULocale locale) { String key = locale.getBaseName(); return GENERIC_NAMES_CACHE.getInstance(key, locale); }
/** * Returns an instance of <code>TimeZoneNames</code> for the specified locale. * * @param locale * The locale. * @return An instance of <code>TimeZoneNames</code> * @stable ICU 49 */ public static TimeZoneNames getInstance(ULocale locale) { String key = locale.getBaseName(); return TZNAMES_CACHE.getInstance(key, locale); }
private String[] getNameListForLocale(ULocale loc) { if (loc != null && ruleSetDisplayNames != null) { String[] localeNames = { loc.getBaseName(), ULocale.getDefault(Category.DISPLAY).getBaseName() }; for (String lname : localeNames) { while (lname.length() > 0) { String[] names = ruleSetDisplayNames.get(lname); if (names != null) { return names; } lname = ULocale.getFallback(lname); } } } return null; }
public PluralRanges getPluralRanges(ULocale locale) { // TODO markdavis Fix the bad fallback, here and elsewhere in this file. String localeId = ULocale.canonicalize(locale.getBaseName()); PluralRanges result; while (null == (result = localeIdToPluralRanges.get(localeId))) { int ix = localeId.lastIndexOf("_"); if (ix == -1) { result = UNKNOWN_RANGE; break; } localeId = localeId.substring(0, ix); } return result; }
public static ICUResourceBundle getBundleInstance( String baseName, ULocale locale, OpenType openType) { if (locale == null) { locale = ULocale.getDefault(); } return getBundleInstance(baseName, locale.getBaseName(), ICUResourceBundle.ICU_DATA_CLASS_LOADER, openType); }
/** * Utility to fetch locale display data from resource bundle tables. Convenience * wrapper for {@link #getTableString(ICUResourceBundle, String, String, String, String)}. */ public static String getTableString(String path, ULocale locale, String tableName, String itemName, String defaultValue) { ICUResourceBundle bundle = (ICUResourceBundle) UResourceBundle. getBundleInstance(path, locale.getBaseName()); return getTableString(bundle, tableName, null, itemName, defaultValue); }
/** * {@icu} Creates a UResourceBundle for the locale specified, from which users can extract * resources by using their corresponding keys. * @param locale specifies the locale for which we want to open the resource. * If null the bundle for default locale is opened. * @return a resource bundle for the given locale * @stable ICU 3.0 */ public static UResourceBundle getBundleInstance(ULocale locale) { if (locale==null) { locale = ULocale.getDefault(); } return getBundleInstance(ICUData.ICU_BASE_NAME, locale.getBaseName(), ICUResourceBundle.ICU_DATA_CLASS_LOADER, false); }
/** * {@icu} Creates a UResourceBundle for the default locale and specified base name, * from which users can extract resources by using their corresponding keys. * @param baseName string containing the name of the data package. * If null the default ICU package name is used. * @return a resource bundle for the given base name and default locale * @stable ICU 3.0 */ public static UResourceBundle getBundleInstance(String baseName) { if (baseName == null) { baseName = ICUData.ICU_BASE_NAME; } ULocale uloc = ULocale.getDefault(); return getBundleInstance(baseName, uloc.getBaseName(), ICUResourceBundle.ICU_DATA_CLASS_LOADER, false); }
public CharsetLMBCS(String icuCanonicalName, String javaCanonicalName, String[] aliases) { super(icuCanonicalName, javaCanonicalName, aliases); maxBytesPerChar = ULMBCS_CHARSIZE_MAX; minBytesPerChar = 1; maxCharsPerByte = 1; extraInfo = new UConverterDataLMBCS(); for (int i = 0; i <= ULMBCS_GRP_LAST; i++) { if (OptGroupByteToCPName[i] != null) { extraInfo.OptGrpConverter[i] = ((CharsetMBCS)CharsetICU.forNameICU(OptGroupByteToCPName[i])).sharedData; } } //get the Opt Group number for the LMBCS converter int option = Integer.parseInt(icuCanonicalName.substring(6)); extraInfo.OptGroup = (short)option; extraInfo.localeConverterIndex = FindLMBCSLocale(ULocale.getDefault().getBaseName()); }
private static String getDisplayLanguageInternal(ULocale locale, ULocale displayLocale, boolean useDialect) { String lang = useDialect ? locale.getBaseName() : locale.getLanguage(); return LocaleDisplayNames.getInstance(displayLocale).languageDisplayName(lang); }
@Override public Locale create(String localeId) { ULocale uLocale = new ULocale(localeId); return create(uLocale.getBaseName(), uLocale.getDisplayNameWithDialect(uLocale), uLocale.getDisplayNameWithDialect(ULocale.ENGLISH)); }
private void initializeNLExtensions() { IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore(); if (!store.isDefault(IPreferenceConstants.NL_EXTENSIONS)) { String nlExtensions = store.getString(IPreferenceConstants.NL_EXTENSIONS); ULocale.setDefault(Category.FORMAT, new ULocale(ULocale.getDefault(Category.FORMAT) .getBaseName() + nlExtensions)); } }