Example usage for java.util Locale TAIWAN

List of usage examples for java.util Locale TAIWAN

Introduction

In this page you can find the example usage for java.util Locale TAIWAN.

Prototype

Locale TAIWAN

To view the source code for java.util Locale TAIWAN.

Click Source Link

Document

Useful constant for country.

Usage

From source file:hk.idv.kenson.jrconsole.Console.java

/**
 * /*  w w w . j  a va  2 s.  com*/
 * @param localeString
 * @return
 */
private static Locale getLocale(String localeString) {
    if ("default".equals(localeString))
        return Locale.getDefault();
    if ("canada".equals(localeString))
        return Locale.CANADA;
    if ("canada_french".equals(localeString))
        return Locale.CANADA_FRENCH;
    if ("china".equals(localeString))
        return Locale.CHINA;
    if ("chinese".equals(localeString))
        return Locale.CHINESE;
    if ("english".equals(localeString))
        return Locale.ENGLISH;
    if ("franch".equals(localeString))
        return Locale.FRANCE;
    if ("german".equals(localeString))
        return Locale.GERMAN;
    if ("germany".equals(localeString))
        return Locale.GERMANY;
    if ("italian".equals(localeString))
        return Locale.ITALIAN;
    if ("italy".equals(localeString))
        return Locale.ITALY;
    if ("japan".equals(localeString))
        return Locale.JAPAN;
    if ("japanese".equals(localeString))
        return Locale.JAPANESE;
    if ("korea".equals(localeString))
        return Locale.KOREA;
    if ("korean".equals(localeString))
        return Locale.KOREAN;
    if ("prc".equals(localeString))
        return Locale.PRC;
    if ("simplified_chinese".equals(localeString))
        return Locale.SIMPLIFIED_CHINESE;
    if ("taiwan".equals(localeString))
        return Locale.TAIWAN;
    if ("traditional_chinese".equals(localeString))
        return Locale.TRADITIONAL_CHINESE;
    if ("uk".equals(localeString))
        return Locale.UK;
    if ("us".equals(localeString))
        return Locale.US;

    String parts[] = localeString.split("_", -1);
    if (parts.length == 1)
        return new Locale(parts[0]);
    else if (parts.length == 2)
        return new Locale(parts[0], parts[1]);
    else
        return new Locale(parts[0], parts[1], parts[2]);
}

From source file:Dates.java

/**
 * Get the year of a date in the specified locale.
 * //w  w  w  .j  a  v a  2  s.  c  o  m
 * <p>
 * Currenty, only Locale.ZH_TW is supported, i.e., "year - 1911" and it's may
 * be less than 0. Otherwise, it is the same as {@link #yearOfDate}.
 * 
 * @param when
 *          The date.
 * @param locale
 *          the locale; if null, the current locale is assumed.
 * @param tz
 *          The time zone; if null, the current time zone is assumed.
 * @see #yearOfDate
 */
public static final int localizedYearOfDate(Date when, Locale locale, TimeZone tz) {
    final int year = yearOfDate(when, tz);
    if (locale.equals(Locale.TAIWAN))
        return year - 1911;
    return year;
}