Example usage for java.util Locale CHINA

List of usage examples for java.util Locale CHINA

Introduction

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

Prototype

Locale CHINA

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

Click Source Link

Document

Useful constant for country.

Usage

From source file:ph.fingra.statisticsweb.controller.CommonController.java

@RequestMapping(method = RequestMethod.POST, value = "/changeLocaleByAjax")
public @ResponseBody String changeLocale(@RequestParam("lang") String lang, HttpServletRequest request,
        HttpServletResponse response) {/*  w  w w  . j a  va  2  s  .com*/
    LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(request);
    Locale locale = null;
    if (lang.equals("ko")) {
        locale = Locale.KOREA;
    } else if (lang.equals("cn")) {
        locale = Locale.CHINA;
    } else if (lang.equals("hk")) {
        locale = Locale.TRADITIONAL_CHINESE;
    } else if (lang.equals("ja")) {
        locale = Locale.JAPAN;
    } else {
        locale = Locale.ENGLISH;
    }

    localeResolver.setLocale(request, response, locale);

    return null;
}

From source file:me.panpf.tool4a.app.ProgressDialogFragment.java

/**
 * ?/*from  w ww  .  j  a  v a 2 s.co m*/
 *
 * @param progressDialog ?
 */
private void applyParams(ProgressDialog progressDialog) {
    if (builder == null)
        throw new IllegalArgumentException("builder null ?setBuilder()Builder");

    progressDialog.setTitle(builder.title);
    progressDialog.setMessage(builder.message != null ? builder.message
            : (Locale.CHINA.equals(Locale.getDefault()) ? MESSAGE_DEFAULT_CHINA : MESSAGE_DEFAULT_OTHER));
    if (builder.confirmButtonName != null) {
        progressDialog.setButton(AlertDialog.BUTTON_POSITIVE, builder.confirmButtonName,
                builder.confirmButtonClickListener);
    }
    if (builder.cancelButtonName != null) {
        progressDialog.setButton(AlertDialog.BUTTON_NEGATIVE, builder.cancelButtonName,
                builder.cancelButtonClickListener);
    }
    if (builder.neutralButtonName != null) {
        progressDialog.setButton(AlertDialog.BUTTON_NEUTRAL, builder.neutralButtonName,
                builder.neutralButtonClickListener);
    }
    progressDialog.setOnKeyListener(builder.onKeyListener);
    progressDialog.setOnShowListener(builder.onShowListener);
    setCancelable(builder.cancelable);
}

From source file:com.arvato.thoroughly.util.CommonUtils.java

/**
 *
 * @param source//from  w  w  w .  ja  v  a2  s. c  om
 *           </br> Format:yyyy-MM-dd HH:mm:ss
 * @return Date
 * @throws ParseException
 */
public static Date stringToDate(String source) throws ParseException {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
    if (StringUtils.isNotEmpty(source)) {
        return sdf.parse(source);
    }
    return null;
}

From source file:com.arvato.thoroughly.util.CommonUtils.java

public static Date lastSecondOfTheDayTime(String source) throws TmallAppException {
    SimpleDateFormat ymd = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
    SimpleDateFormat ymdhms = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
    Date newDate = null;/*www  .j ava 2 s.com*/
    try {
        Date oldDate = ymd.parse(source);
        newDate = ymdhms.parse(ymd.format(oldDate) + " 23:59:59");
    } catch (ParseException e) {
        LOGGER.error(e.getMessage(), e);
        throw new TmallAppException(ResponseCode.INTERNAL_SERVER_ERROR.getCode(), e.getMessage());
    }
    return newDate;
}

From source file:com.personal.coine.scorpion.jxnuhelper.view.activity.SchoolCalendarActivity.java

@Override
public void onScrollToDate(Calendar calendar) {
    actionBar.setTitle(calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.CHINA));
}

From source file:com.hihframework.core.utils.DateUtils.java

public static String formatDateLong(long millis) {
    String pattern = "yyyy-MM-dd HH:mm";
    String date = DateFormatUtils.format(millis, pattern, Locale.CHINA);
    return date;/*from  w w w  .ja v  a  2s  .  co  m*/
}

From source file:io.github.mkjung.ivi.VLCApplication.java

@Override
public void onCreate() {
    super.onCreate();

    // Are we using advanced debugging - locale?
    mSettings = PreferenceManager.getDefaultSharedPreferences(this);
    String p = mSettings.getString("set_locale", "");
    if (!p.equals("")) {
        Locale locale;//www  . ja  va  2s.  c o m
        // workaround due to region code
        if (p.equals("zh-TW")) {
            locale = Locale.TRADITIONAL_CHINESE;
        } else if (p.startsWith("zh")) {
            locale = Locale.CHINA;
        } else if (p.equals("pt-BR")) {
            locale = new Locale("pt", "BR");
        } else if (p.equals("bn-IN") || p.startsWith("bn")) {
            locale = new Locale("bn", "IN");
        } else {
            /**
             * Avoid a crash of
             * java.lang.AssertionError: couldn't initialize LocaleData for locale
             * if the user enters nonsensical region codes.
             */
            if (p.contains("-"))
                p = p.substring(0, p.indexOf('-'));
            locale = new Locale(p);
        }
        Locale.setDefault(locale);
        Configuration config = new Configuration();
        config.locale = locale;
        getResources().updateConfiguration(config, getResources().getDisplayMetrics());
    }

    instance = this;

    // Initialize the database soon enough to avoid any race condition and crash
    MediaDatabase.getInstance();
    // Prepare cache folder constants
    AudioUtil.prepareCacheFolder(this);

    sTV = AndroidDevices.isAndroidTv() || !AndroidDevices.hasTsp();

    Dialog.setCallbacks(VLCInstance.get(), mDialogCallbacks);

    // Disable remote control receiver on Fire TV.
    //        if (!AndroidDevices.hasTsp())
    //            AndroidDevices.setRemoteControlReceiverEnabled(false);
}

From source file:org.videolan.vlc.VLCApp.java

public void onCreate() {
    // Are we using advanced debugging - locale?
    mSettings = PreferenceManager.getDefaultSharedPreferences(context);
    String p = mSettings.getString("set_locale", "");
    if (!p.equals("")) {
        Locale locale;/*from   ww  w .  j a  v a  2 s . co  m*/
        // workaround due to region code
        if (p.equals("zh-TW")) {
            locale = Locale.TRADITIONAL_CHINESE;
        } else if (p.startsWith("zh")) {
            locale = Locale.CHINA;
        } else if (p.equals("pt-BR")) {
            locale = new Locale("pt", "BR");
        } else if (p.equals("bn-IN") || p.startsWith("bn")) {
            locale = new Locale("bn", "IN");
        } else {
            /**
             * Avoid a crash of
             * java.lang.AssertionError: couldn't initialize LocaleData for locale
             * if the user enters nonsensical region codes.
             */
            if (p.contains("-"))
                p = p.substring(0, p.indexOf('-'));
            locale = new Locale(p);
        }
        Locale.setDefault(locale);
        Configuration config = new Configuration();
        config.locale = locale;
        context.getResources().updateConfiguration(config, context.getResources().getDisplayMetrics());
    }
    // Initialize the database soon enough to avoid any race condition and crash
    //        MediaDatabase.getInstance();
    // Prepare cache folder constants
    AudioUtil.prepareCacheFolder(context);

    sTV = AndroidDevices.isAndroidTv() || !AndroidDevices.hasTsp();

    Dialog.setCallbacks(VLCInstance.get(), mDialogCallbacks);

    // Disable remote control receiver on Fire TV.
    if (!AndroidDevices.hasTsp())
        AndroidDevices.setRemoteControlReceiverEnabled(false);
}

From source file:org.videolan.vlc.VLCApplication.java

@Override
public void onCreate() {
    super.onCreate();

    // Are we using advanced debugging - locale?
    mSettings = PreferenceManager.getDefaultSharedPreferences(this);
    String p = mSettings.getString("set_locale", "");
    if (!p.equals("")) {
        Locale locale;// www . ja v  a 2 s. c  o m
        // workaround due to region code
        if (p.equals("zh-TW")) {
            locale = Locale.TRADITIONAL_CHINESE;
        } else if (p.startsWith("zh")) {
            locale = Locale.CHINA;
        } else if (p.equals("pt-BR")) {
            locale = new Locale("pt", "BR");
        } else if (p.equals("bn-IN") || p.startsWith("bn")) {
            locale = new Locale("bn", "IN");
        } else {
            /**
             * Avoid a crash of
             * java.lang.AssertionError: couldn't initialize LocaleData for locale
             * if the user enters nonsensical region codes.
             */
            if (p.contains("-"))
                p = p.substring(0, p.indexOf('-'));
            locale = new Locale(p);
        }
        Locale.setDefault(locale);
        Configuration config = new Configuration();
        config.locale = locale;
        getResources().updateConfiguration(config, getResources().getDisplayMetrics());
    }

    instance = this;

    // Initialize the database soon enough to avoid any race condition and crash
    MediaDatabase.getInstance();
    // Prepare cache folder constants
    AudioUtil.prepareCacheFolder(this);

    sTV = AndroidDevices.isAndroidTv() || !AndroidDevices.hasTsp();

    if (!VLCInstance.testCompatibleCPU(this))
        return;
    Dialog.setCallbacks(VLCInstance.get(), mDialogCallbacks);

    // Disable remote control receiver on Fire TV.
    if (!AndroidDevices.hasTsp())
        AndroidDevices.setRemoteControlReceiverEnabled(false);

    if (Permissions.canReadStorage())
        discoverStorages(getMLInstance());
}