当前位置: 首页>>代码示例>>Java>>正文


Java ULocale.getBaseName方法代码示例

本文整理汇总了Java中com.ibm.icu.util.ULocale.getBaseName方法的典型用法代码示例。如果您正苦于以下问题:Java ULocale.getBaseName方法的具体用法?Java ULocale.getBaseName怎么用?Java ULocale.getBaseName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.ibm.icu.util.ULocale的用法示例。


在下文中一共展示了ULocale.getBaseName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBundleInstance

import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
public static ICUResourceBundle getBundleInstance(String baseName, String localeID,
        ClassLoader root, OpenType openType) {
    if (baseName == null) {
        baseName = ICUData.ICU_BASE_NAME;
    }
    localeID = ULocale.getBaseName(localeID);
    ICUResourceBundle b;
    if (openType == OpenType.LOCALE_DEFAULT_ROOT) {
        b = instantiateBundle(baseName, localeID, ULocale.getDefault().getBaseName(),
                root, openType);
    } else {
        b = instantiateBundle(baseName, localeID, null, root, openType);
    }
    if(b==null){
        throw new MissingResourceException(
                "Could not find the bundle "+ baseName+"/"+ localeID+".res","","");
    }
    return b;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:20,代码来源:ICUResourceBundle.java

示例2: getInstance

import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
/**
 * Returns the default numbering system for the specified ULocale.
 * @stable ICU 4.2
 */
public static NumberingSystem getInstance(ULocale locale) {
    // Check for @numbers
    boolean nsResolved = true;
    String numbersKeyword = locale.getKeywordValue("numbers");
    if (numbersKeyword != null ) {
        for ( String keyword : OTHER_NS_KEYWORDS ) {
            if ( numbersKeyword.equals(keyword)) {
                nsResolved = false;
                break;
            }
        }
    } else {
        numbersKeyword = "default";
        nsResolved = false;
    }

    if (nsResolved) {
        NumberingSystem ns = getInstanceByName(numbersKeyword);
        if (ns != null) {
            return ns;
        }
        // If the @numbers keyword points to a bogus numbering system name,
        // we return the default for the locale.
        numbersKeyword = "default";
    }

    // Attempt to get the numbering system from the cache
    String baseName = locale.getBaseName();
    // TODO: Caching by locale+numbersKeyword could yield a large cache.
    // Try to load for each locale the mappings from OTHER_NS_KEYWORDS and default
    // to real numbering system names; can we get those from supplemental data?
    // Then look up those mappings for the locale and resolve the keyword.
    String key = baseName+"@numbers="+numbersKeyword;
    LocaleLookupData localeLookupData = new LocaleLookupData(locale, numbersKeyword);
    return cachedLocaleData.getInstance(key, localeLookupData);
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:41,代码来源:NumberingSystem.java

示例3: getNameListForLocale

import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
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;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:16,代码来源:RuleBasedNumberFormat.java

示例4: initializeData

import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
/**
 * Initializes format symbols for the locale and calendar type
 * @param desiredLocale The locale whose symbols are desired.
 * @param type          The calendar type whose date format symbols are desired.
 * @stable ICU 3.0
 */
//TODO: This protected seems to be marked as @stable accidentally.
// We may need to deescalate this API to @internal.
protected void initializeData(ULocale desiredLocale, String type)
{
    String key = desiredLocale.getBaseName() + '+' + type;
    String ns = desiredLocale.getKeywordValue("numbers");
    if (ns != null && ns.length() > 0) {
        key += '+' + ns;
    }
    DateFormatSymbols dfs = DFSCACHE.getInstance(key, desiredLocale);
    initializeData(dfs);
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:19,代码来源:DateFormatSymbols.java

示例5: getDisplayName

import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
/**
 * Return the name of the collator for the objectLocale, localized for the displayLocale.
 * If objectLocale is not visible or not defined by the factory, return null.
 * @param objectLocale the locale identifying the collator
 * @param displayLocale the locale for which the display name of the collator should be localized
 * @return the display name
 * @stable ICU 3.2
 */
public String getDisplayName(ULocale objectLocale, ULocale displayLocale) {
    if (visible()) {
        Set<String> supported = getSupportedLocaleIDs();
        String name = objectLocale.getBaseName();
        if (supported.contains(name)) {
            return objectLocale.getDisplayName(displayLocale);
        }
    }
    return null;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:19,代码来源:Collator.java

示例6: SimpleLocaleKeyFactory

import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
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;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:8,代码来源:ICULocaleService.java

示例7: validateFallbackLocale

import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
/**
 * Return the name of the current fallback locale.  If it has changed since this was
 * last accessed, the service cache is cleared.
 */
public String validateFallbackLocale() {
    ULocale loc = ULocale.getDefault();
    if (loc != fallbackLocale) {
        synchronized (this) {
            if (loc != fallbackLocale) {
                fallbackLocale = loc;
                fallbackLocaleName = loc.getBaseName();
                clearServiceCache();
            }
        }
    }
    return fallbackLocaleName;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:18,代码来源:ICULocaleService.java

示例8: processOverrideString

import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
private void processOverrideString(ULocale loc, String str) {

        if ( str == null || str.length() == 0 )
            return;

        int start = 0;
        int end;
        String nsName;
        Character ovrField;
        boolean moreToProcess = true;
        boolean fullOverride;

        while (moreToProcess) {
            int delimiterPosition = str.indexOf(";",start);
            if (delimiterPosition == -1) {
                moreToProcess = false;
                end = str.length();
            } else {
                end = delimiterPosition;
            }

            String currentString = str.substring(start,end);
            int equalSignPosition = currentString.indexOf("=");
            if (equalSignPosition == -1) { // Simple override string such as "hebrew"
               nsName = currentString;
               fullOverride = true;
            } else { // Field specific override string such as "y=hebrew"
               nsName = currentString.substring(equalSignPosition+1);
               ovrField = Character.valueOf(currentString.charAt(0));
               overrideMap.put(ovrField,nsName);
               fullOverride = false;
            }

            ULocale ovrLoc = new ULocale(loc.getBaseName()+"@numbers="+nsName);
            NumberFormat nf = NumberFormat.createInstance(ovrLoc,NumberFormat.NUMBERSTYLE);
            nf.setGroupingUsed(false);

            if (fullOverride) {
                setNumberFormat(nf);
            } else {
                // Since one or more of the override number formatters might be complex,
                // we can't rely on the fast numfmt where we have a partial field override.
                useLocalZeroPaddingNumberFormat = false;
            }

            if (!fullOverride && !numberFormatters.containsKey(nsName)) {
                  numberFormatters.put(nsName,nf);
            }

            start = delimiterPosition + 1;
        }
    }
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:53,代码来源:SimpleDateFormat.java

示例9: getInstance

import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:13,代码来源:TimeZoneNames.java

示例10: getInstance

import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:11,代码来源:TimeZoneGenericNames.java


注:本文中的com.ibm.icu.util.ULocale.getBaseName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。