Java Code Examples for org.springframework.web.servlet.i18n.CookieLocaleResolver#setDefaultLocale()

The following examples show how to use org.springframework.web.servlet.i18n.CookieLocaleResolver#setDefaultLocale() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebMvcConfig.java    From scaffold-cloud with MIT License 5 votes vote down vote up
@Bean
public LocaleResolver localeResolver() {
    CookieLocaleResolver slr = new CookieLocaleResolver();
    slr.setDefaultLocale(Locale.CHINA);
    slr.setCookieMaxAge(LOCAL_COOKIE_TIME);
    return slr;

}
 
Example 2
Source File: WebConfig.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Bean
CookieLocaleResolver localeResolver() {
    CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver();
    cookieLocaleResolver.setDefaultLocale(Locale.ENGLISH);
    cookieLocaleResolver.setCookieMaxAge(3600);
    cookieLocaleResolver.setCookieName("locale");
    return cookieLocaleResolver;
}
 
Example 3
Source File: WebConfig.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Bean
CookieLocaleResolver localeResolver() {
    CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver();
    cookieLocaleResolver.setDefaultLocale(Locale.ENGLISH);
    cookieLocaleResolver.setCookieMaxAge(3600);
    cookieLocaleResolver.setCookieName("locale");
    return cookieLocaleResolver;
}
 
Example 4
Source File: WebConfig.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Bean
CookieLocaleResolver localeResolver() {
    CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver();
    cookieLocaleResolver.setDefaultLocale(Locale.ENGLISH);
    cookieLocaleResolver.setCookieMaxAge(3600);
    cookieLocaleResolver.setCookieName("locale");
    return cookieLocaleResolver;
}
 
Example 5
Source File: WebConfig.java    From Spring with Apache License 2.0 5 votes vote down vote up
/**
 * Cookie configuration for the internationalization settings
 */
@Bean
CookieLocaleResolver localeResolver() {
    final CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver();
    cookieLocaleResolver.setDefaultLocale(Locale.ENGLISH);
    cookieLocaleResolver.setCookieMaxAge(3600);
    cookieLocaleResolver.setCookieName("locale");
    return cookieLocaleResolver;
}
 
Example 6
Source File: WebAppConfig.java    From SA47 with The Unlicense 5 votes vote down vote up
@Bean
public LocaleResolver localeResolver() {

	CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver();
	cookieLocaleResolver.setDefaultLocale(StringUtils
			.parseLocaleString("en"));
	return cookieLocaleResolver;
}
 
Example 7
Source File: WebAppConfig.java    From SA47 with The Unlicense 5 votes vote down vote up
@Bean
public LocaleResolver localeResolver() {

	CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver();
	cookieLocaleResolver.setDefaultLocale(StringUtils
			.parseLocaleString("en"));
	return cookieLocaleResolver;
}
 
Example 8
Source File: I18nApplication.java    From Spring-Boot-I18n-Pro with MIT License 5 votes vote down vote up
@Bean
public LocaleResolver localeResolver() {
    CookieLocaleResolver slr = new CookieLocaleResolver();
    slr.setDefaultLocale(Locale.CHINA);
    slr.setCookieMaxAge(3600);
    slr.setCookieName("Language");
    return slr;
}
 
Example 9
Source File: MvcConfig.java    From tutorials with MIT License 4 votes vote down vote up
@Bean
public LocaleResolver localeResolver() {
    CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver();
    cookieLocaleResolver.setDefaultLocale(Locale.ENGLISH);
    return cookieLocaleResolver;
}