Exemple #1
0
 @Bean
 public CookieLocaleResolver localeResolver() {
   CookieLocaleResolver localeResolver = new CookieLocaleResolver();
   Locale defaultLocale = new Locale("fr");
   localeResolver.setDefaultLocale(defaultLocale);
   return localeResolver;
 }
Exemple #2
0
 @Bean(name = "localeResolver")
 public LocaleResolver localeResolver() {
   CookieLocaleResolver localeResolver = new CookieLocaleResolver();
   localeResolver.setCookieName("holiday_locale");
   localeResolver.setDefaultLocale(new Locale("en"));
   return localeResolver;
 }
 @Bean
 public LocaleResolver localeResolver() {
   CookieLocaleResolver localeResolver = new CookieLocaleResolver();
   localeResolver.setDefaultLocale(Locale.ENGLISH);
   localeResolver.setCookieMaxAge(604800);
   return localeResolver;
 }
 @Bean
 public LocaleResolver localeResolver() {
   CookieLocaleResolver resolver = new CookieLocaleResolver();
   resolver.setDefaultLocale(new Locale("en"));
   resolver.setCookieName("cookie_name");
   resolver.setCookieMaxAge(4800);
   return resolver;
 }
 @Bean
 public LocaleResolver localeResolver() {
   CookieLocaleResolver resolver = new CookieLocaleResolver();
   resolver.setDefaultLocale(new Locale("ru"));
   resolver.setCookieName("localeCookie");
   resolver.setCookieMaxAge(7 * 24 * 3600);
   return resolver;
 }
  @Before
  public void setup() {

    CookieLocaleResolver localeResolver = new CookieLocaleResolver();
    localeResolver.setCookieDomain("domain");

    this.mockMvc =
        standaloneSetup(new SimpleController())
            .addInterceptors(new LocaleChangeInterceptor())
            .setLocaleResolver(localeResolver)
            .build();
  }
 @Bean
 public LocaleResolver localeResolver() {
   CookieLocaleResolver localeResolver = new CookieLocaleResolver();
   localeResolver.setDefaultLocale(Locale.US);
   return localeResolver;
 }
 @Override
 public void addCookie(HttpServletResponse response, String cookieValue) {
   // Mandatory cookie modification for angular to support the locale switching on the server side.
   cookieValue = "%22" + cookieValue + "%22";
   super.addCookie(response, cookieValue);
 }