Package org.springframework.web.servlet

Examples of org.springframework.web.servlet.LocaleResolver


        PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    // mock request and set user preferred locale
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.addPreferredLocale(StringUtils.parseLocaleString("nl_NL"));
    LocaleResolver localeResolver = this.context.getBean(LocaleResolver.class);
    Locale locale = localeResolver.resolveLocale(request);
    assertThat(localeResolver, instanceOf(FixedLocaleResolver.class));
    // test locale resolver uses fixed locale and not user preferred locale
    assertThat(locale.toString(), equalTo("en_UK"));
  }
View Full Code Here


 
  /**
   * 获得i18n字符串
   */
  public static String getMessage(String code, Object[] args) {
    LocaleResolver localLocaleResolver = SpringContextHolder.getBean(LocaleResolver.class);
    HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest()
    Locale localLocale = localLocaleResolver.resolveLocale(request);
    return SpringContextHolder.getApplicationContext().getMessage(code, args, localLocale);
  }
View Full Code Here

        return "/plugin/org.joget.apps.form.lib.TextField/images/textField_icon.gif";
    }
   
    protected String getJavaDateFormat(String format) {
        if (format == null || format.isEmpty()) {
            LocaleResolver localeResolver = (LocaleResolver) AppUtil.getApplicationContext().getBean("localeResolver")
            Locale locale = localeResolver.resolveLocale(WorkflowUtil.getHttpServletRequest());
            if (locale != null && locale.toString().startsWith("zh")) {
                return "yyyy-MM-dd";
            } else {
                return "MM/dd/yyyy";
            }
View Full Code Here

TOP

Related Classes of org.springframework.web.servlet.LocaleResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.