Example usage for java.util Locale CHINESE

List of usage examples for java.util Locale CHINESE

Introduction

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

Prototype

Locale CHINESE

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

Click Source Link

Document

Useful constant for language.

Usage

From source file:Main.java

public static Calendar calendar() {
    Calendar cal = GregorianCalendar.getInstance(Locale.CHINESE);
    cal.setFirstDayOfWeek(Calendar.MONDAY);
    return cal;//www . j  a  v a 2  s .  c o  m
}

From source file:Main.java

public static boolean isChinese() {
    return Locale.getDefault().getLanguage().startsWith(Locale.CHINESE.getLanguage());
}

From source file:Main.java

static void checkPositive(int number, String name) {
    if (number <= 0)
        throw new IllegalArgumentException(String.format(Locale.CHINESE, "%s must not be null", name));
}

From source file:Main.java

static void checkAngle(int angle) {
    if (angle < 0 || angle > 360)
        throw new IllegalArgumentException(
                String.format(Locale.CHINESE, "Illegal angle %d: must be >=0 and <= 360", angle));
}

From source file:Main.java

static void checkPositiveOrZero(float number, String name) {
    if (number < 0)
        throw new IllegalArgumentException(
                String.format(Locale.CHINESE, "%s %d must be positive", name, (int) number));
}

From source file:Main.java

public static boolean isChineseLanguage() {

    return Resources.getSystem().getConfiguration().locale.getLanguage()
            .startsWith(Locale.CHINESE.getLanguage());

}

From source file:Main.java

public static void updateConfiguration(Context context) {
    Resources resources = context.getResources();
    Configuration conf = resources.getConfiguration();
    Locale current = Locale.getDefault();
    String currentLanguage = current.getDisplayLanguage();

    if (Locale.CHINESE.getDisplayLanguage().equals(currentLanguage)
            || Locale.ENGLISH.getDisplayLanguage().equals(currentLanguage)) {
        return;/*from  w w w .  j  av  a2 s  .c o  m*/
    }

    conf.locale = Locale.ENGLISH;
    resources.updateConfiguration(conf, resources.getDisplayMetrics());
}

From source file:com.tomtop.management.base.controllers.WelcomeController.java

@RequestMapping("/welcome")
public String welcome(Map<String, Object> model) {
    model.put("time", new Date());
    model.put("message", this.message);
    model.put("layoutsize", messageResource.getMessage("page.save", null, Locale.CHINESE));
    logger.debug("debug--welcome--page--{}", 1);
    logger.info("info--welcome--page--{}", 2);
    logger.error("error--welcome--page--{}", 3);
    return "welcome";
}

From source file:test.unit.be.fedict.eid.applet.MessagesTest.java

@Test
public void testUnsupportedLanguageUnsupportedDefaultLanguage() throws Exception {
    Locale.setDefault(Locale.CHINESE);
    Locale locale = Locale.JAPANESE;
    Messages messages = new Messages(locale);
    String message = messages.getMessage(Messages.MESSAGE_ID.GENERIC_ERROR);
    LOG.debug("message: " + message);
    assertEquals("Generic Error.", message);
}

From source file:org.hippoecm.frontend.plugins.login.LoginPanel.java

private Locale getSelectedLocale() {
    if (selectedLocale.equals(Locale.CHINESE.getLanguage())) {
        // always use simplified Chinese, Wicket does not known Chinese without a country
        return Locale.SIMPLIFIED_CHINESE;
    }/*from w  w  w. j  a va 2  s .c  om*/
    return new Locale(selectedLocale);
}