Example usage for java.util Locale SIMPLIFIED_CHINESE

List of usage examples for java.util Locale SIMPLIFIED_CHINESE

Introduction

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

Prototype

Locale SIMPLIFIED_CHINESE

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

Click Source Link

Document

Useful constant for language.

Usage

From source file:com.jmhz.device.util.PrettyTimeUtils.java

/**
 *   1?? 2?//from   w  ww .j ava  2  s.  co  m
 *
 * @return
 */
public static final String prettyTime(Date date) {
    PrettyTime p = new PrettyTime();
    p.setLocale(Locale.SIMPLIFIED_CHINESE);
    return p.format(date);

}

From source file:com.jmhz.device.util.PrettyTimeUtils.java

public static final String prettyTime(long millisecond) {
    PrettyTime p = new PrettyTime();
    p.setLocale(Locale.SIMPLIFIED_CHINESE);
    return p.format(new Date(millisecond));
}

From source file:com.iflytek.edu.cloud.frame.InitializingService.java

@Override
public void afterPropertiesSet() throws Exception {
    //hibernate validator 
    Locale.setDefault(Locale.SIMPLIFIED_CHINESE);

    ResourceBundleMessageSource bundleMessageSource = new ResourceBundleMessageSource();
    bundleMessageSource.setBasenames(I18N_ROP_ERROR);
    LOGGER.info("?" + I18N_ROP_ERROR);

    MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(bundleMessageSource);
    MainErrors.setErrorMessageSourceAccessor(messageSourceAccessor);
    SubErrors.setErrorMessageSourceAccessor(messageSourceAccessor);
}

From source file:org.b3log.solo.util.ThumbnailsTestCase.java

/**
 * Test method for {@linkplain Thumbnails#getGravatarURL(java.lang.String, java.lang.String)}.
 * /*from   www  . j  a  v a2 s.  c o m*/
 * @throws Exception exception
 */
@Test
public void getGravatarURL() throws Exception {
    Latkes.initRuntimeEnv();
    Latkes.setLocale(Locale.SIMPLIFIED_CHINESE);

    final String gravatarURL = Thumbnails.getGravatarURL("test@b3log.org", "60");

    System.out.println(gravatarURL);
}

From source file:cn.edu.zjnu.acm.judge.config.LocaleConfiguration.java

@Bean(name = "localeResolver")
public LocaleResolver localeResolver(ServletContext container, LocaleFactory localeFactory) {
    CookieLocaleResolver localeResolver = new CookieLocaleResolver();
    localeResolver.setCookieName("locale");
    localeResolver.setCookieMaxAge(15 * 24 * 60 * 60);
    localeResolver.setCookiePath(getCookiePath(container));
    return new FilterLocaleResolver(localeResolver, Locale.SIMPLIFIED_CHINESE,
            locale -> localeFactory.getAllLanguages().contains(locale.getLanguage()));
}

From source file:info.donsun.core.mapper.JsonMapper.java

public JsonMapper(Include include) {
    mapper = new ObjectMapper();
    // ?/* ww w  . ja  v  a  2  s.  co  m*/
    if (include != null) {
        mapper.setSerializationInclusion(include);
    }
    // JSONJava
    mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
    mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
    mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
    mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.SIMPLIFIED_CHINESE));
}

From source file:com.alibaba.dubbo.governance.web.common.interceptor.LocaleValve.java

public void invoke(PipelineContext pipelineContext) throws Exception {
    TurbineRunData rundata = getTurbineRunData(request);
    if (ignoreTarget(rundata.getTarget())) {
        pipelineContext.invokeNext();/*w w  w  . ja  va 2 s  .c o  m*/
        return;
    }

    //
    String[] temp = rundata.getCookies().getStrings("locale");
    String locale = null;
    if (temp != null) {
        if (temp.length > 1) {
            locale = temp[temp.length - 1];
        } else if (temp.length == 1) {
            locale = temp[0];
        }
    }
    if (locale == null || "".equals(locale)) {
        locale = "zh";
    }

    Locale newLocale = Locale.SIMPLIFIED_CHINESE;
    if ("en".equals(locale)) {
        newLocale = Locale.ENGLISH;
    } else if ("zh".equals(locale)) {
        newLocale = Locale.SIMPLIFIED_CHINESE;
    } else if ("zh_TW".equals(locale)) {
        newLocale = Locale.TRADITIONAL_CHINESE;
    }
    LocaleUtil.setLocale(newLocale);

    pipelineContext.invokeNext();
}

From source file:com.android.providers.contacts.LocaleSet.java

public static boolean isLocaleSimplifiedChinese(Locale locale) {
    // language must match
    if (locale == null || !TextUtils.equals(locale.getLanguage(), CHINESE_LANGUAGE)) {
        return false;
    }// w  w w.j  a  va 2s.  c om

    // script is optional but if present must match
    if (!TextUtils.isEmpty(ICUCompat.maximizeAndGetScript(locale))) {
        return ICUCompat.maximizeAndGetScript(locale).equals(SCRIPT_SIMPLIFIED_CHINESE);
    }
    // if no script, must match known country
    return locale.equals(Locale.SIMPLIFIED_CHINESE);
}

From source file:org.b3log.solo.AbstractTestCase.java

/**
 * Before class./*from   w w  w  .ja  v a  2  s. c  o  m*/
 * <ol>
 * <li>Initializes Latke runtime</li>
 * <li>Instantiates repositories</li>
 * </ol>
 *
 * @throws Exception exception
 */
@BeforeClass
public void beforeClass() throws Exception {
    Latkes.init();
    Latkes.setLocale(Locale.SIMPLIFIED_CHINESE);

    final Collection<Class<?>> classes = Discoverer.discover("org.b3log.solo");
    BeanManager.start(classes);
    beanManager = BeanManager.getInstance();

    final Connection connection = Connections.getConnection();
    connection.createStatement().execute("DROP ALL OBJECTS");
    connection.close();

    JdbcRepositories.initAllTables();
}

From source file:org.liberty.android.fantastischmemo.AMActivity.java

private void updateInterfaceLanguage() {
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
    String localeSetting = settings.getString(AMPrefKeys.INTERFACE_LOCALE_KEY, "AUTO");
    Locale locale;//w  w w .  ja  va  2 s .  c o  m
    /* Force to use the a language */
    if (localeSetting.equals("EN")) {
        locale = Locale.US;
    } else if (localeSetting.equals("SC")) {
        locale = Locale.SIMPLIFIED_CHINESE;
    } else if (localeSetting.equals("TC")) {
        locale = Locale.TRADITIONAL_CHINESE;
    } else if (localeSetting.equals("CS")) {
        locale = new Locale("CS");
    } else if (localeSetting.equals("PL")) {
        locale = new Locale("PL");
    } else if (localeSetting.equals("RU")) {
        locale = new Locale("RU");
    } else if (localeSetting.equals("DE")) {
        locale = new Locale("DE");
    } else if (localeSetting.equals("KO")) {
        locale = new Locale("KO");
    } else if (localeSetting.equals("FR")) {
        locale = new Locale("FR");
    } else if (localeSetting.equals("PT")) {
        locale = new Locale("PT");
    } else if (localeSetting.equals("JA")) {
        locale = new Locale("JA");
    } else if (localeSetting.equals("ES")) {
        locale = new Locale("ES");
    } else if (localeSetting.equals("IT")) {
        locale = Locale.ITALIAN;
    } else {
        locale = Locale.getDefault();
    }
    Configuration config = new Configuration();
    config.locale = locale;
    getBaseContext().getResources().updateConfiguration(config,
            getBaseContext().getResources().getDisplayMetrics());
}