Example usage for org.springframework.web.servlet.i18n CookieLocaleResolver setDefaultLocale

List of usage examples for org.springframework.web.servlet.i18n CookieLocaleResolver setDefaultLocale

Introduction

In this page you can find the example usage for org.springframework.web.servlet.i18n CookieLocaleResolver setDefaultLocale.

Prototype

public void setDefaultLocale(@Nullable Locale defaultLocale) 

Source Link

Document

Set a fixed locale that this resolver will return if no cookie found.

Usage

From source file:com.castlemock.war.config.MvcConfig.java

/**
 * Creates a locale resolver. This is used to identify which language is currently configured to be used
 * for a user/*w  w  w  .j  a v a  2 s .co m*/
 * @return A new cookie locale resolver
 */
@Bean
public LocaleResolver localeResolver() {
    final CookieLocaleResolver ret = new CookieLocaleResolver();
    ret.setDefaultLocale(new Locale("en"));
    return ret;
}

From source file:com.pavikumbhar.javaheart.springconfiguration.WebAppConfig.java

@Bean
public LocaleResolver localeResolver() {
    final CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver();
    cookieLocaleResolver.setDefaultLocale(Locale.ENGLISH);
    return cookieLocaleResolver;
}

From source file:org.openlmis.fulfillment.Application.java

/**
 * Creates new LocaleResolver./*  w w  w.  j  av a 2s  . com*/
 *
 * @return Created LocalResolver.
 */
@Bean
public LocaleResolver localeResolver() {
    CookieLocaleResolver lr = new CookieLocaleResolver();
    lr.setCookieName("lang");
    lr.setDefaultLocale(locale);
    return lr;
}

From source file:com.alehuo.wepas2016projekti.configuration.DevelopmentConfiguration.java

/**
 * Lokalisaatioevsteen asetus//from  w  w  w .ja  v a 2  s .c o  m
 * 
 * Oletusarvoinen lokalisaatio: fi_FI
 * 
 * @return 
 */
@Bean
public CookieLocaleResolver localeResolver() {
    CookieLocaleResolver localeResolver = new CookieLocaleResolver();
    Locale finnishLocale = new Locale.Builder().setLanguage("fi").setRegion("FI").build();
    localeResolver.setDefaultLocale(finnishLocale);
    localeResolver.setCookieName("locale");
    //Evste vanhenee tunnissa
    localeResolver.setCookieMaxAge(3600);
    return localeResolver;
}