All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.fhframework.app.WebConfig Maven / Gradle / Ivy

There is a newer version: 4.10.401
Show newest version
package pl.fhframework.app;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration;
import org.springframework.web.servlet.i18n.CookieLocaleResolver;

import java.util.Locale;

@Configuration
@Slf4j
@Order(1)
public class WebConfig extends DelegatingWebMvcConfiguration {

    @Value("${fhframework.language.default:pl}")
    private String defaultLang;

    @Bean
    @Override
    public LocaleResolver localeResolver() {
        log.info("************* Start cookie locale resolver...");
        CookieLocaleResolver resolver = new CookieLocaleResolver();
        resolver.setCookieName("USERLANG");
        resolver.setDefaultLocale(Locale.forLanguageTag(defaultLang));
        return resolver;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy