Java Code Examples for org.springframework.web.servlet.i18n.LocaleChangeInterceptor#setParamName()

The following examples show how to use org.springframework.web.servlet.i18n.LocaleChangeInterceptor#setParamName() . 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: I18nConfig.java    From springboot-learn with MIT License 6 votes vote down vote up
/**
     * Cookie方式
     */
//    @Bean
//    public LocaleResolver localeResolver2() {
//        CookieLocaleResolver clr = new CookieLocaleResolver();
//        clr.setCookieName("localeCookie");
//        //设置默认区域
//        clr.setDefaultLocale(Locale.US);
//        //设置cookie有效期.
//        clr.setCookieMaxAge(3600);
//        return clr;
//    }
    @Bean
    public LocaleChangeInterceptor localeChangeInterceptor() {
        LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
        //对请求页面路径中的参数lang进行拦截
        lci.setParamName("lang");

        return lci;
    }
 
Example 2
Source File: I18nConfig.java    From supplierShop with MIT License 5 votes vote down vote up
@Bean
public LocaleChangeInterceptor localeChangeInterceptor()
{
    LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
    // 参数名
    lci.setParamName("lang");
    return lci;
}
 
Example 3
Source File: WebAppConfig.java    From SA47 with The Unlicense 5 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {

	LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
	localeChangeInterceptor.setParamName("lang");
	registry.addInterceptor(localeChangeInterceptor);
}
 
Example 4
Source File: WebMvcConfig.java    From spring-boot-excel-upload-demo with MIT License 5 votes vote down vote up
@Bean
public LocaleChangeInterceptor localeChangeInterceptor() {
   LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
   lci.setParamName("lang");

   return lci;
}
 
Example 5
Source File: DispatcherServletConfiguration.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
protected void addInterceptors(InterceptorRegistry registry) {
    LOGGER.debug("Configuring localeChangeInterceptor");
    LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
    localeChangeInterceptor.setParamName("language");
    registry.addInterceptor(localeChangeInterceptor);
}
 
Example 6
Source File: InterceptorConfiguration.java    From EasyEE with MIT License 5 votes vote down vote up
/**
 * Interceptors
 */
@Override
public void addInterceptors(InterceptorRegistry registry) {
	
	// Log HandlerInterceptor
	LogInterceptor logInterceptor=new LogInterceptor();
	logInterceptor.setSysLogService(sysLogService); // 手动注入
	registry.addInterceptor(logInterceptor).addPathPatterns("/**");

	// I18N HandlerInterceptor
	LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
	localeChangeInterceptor.setParamName("lang");
	registry.addInterceptor(localeChangeInterceptor).addPathPatterns("/**");
	super.addInterceptors(registry);
}
 
Example 7
Source File: WebMvcConfig.java    From FlyCms with MIT License 5 votes vote down vote up
@Bean
public LocaleChangeInterceptor localeChangeInterceptor() {
	LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
	// 参数名
	lci.setParamName("lang");
	return lci;
}
 
Example 8
Source File: I18nConfig.java    From LuckyFrameWeb with GNU Affero General Public License v3.0 5 votes vote down vote up
@Bean
public LocaleChangeInterceptor localeChangeInterceptor()
{
    LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
    // 参数名
    lci.setParamName("lang");
    return lci;
}
 
Example 9
Source File: DispatcherServletConfiguration.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
protected void addInterceptors(InterceptorRegistry registry) {
    LOGGER.debug("Configuring localeChangeInterceptor");
    LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
    localeChangeInterceptor.setParamName("language");
    registry.addInterceptor(localeChangeInterceptor);
}
 
Example 10
Source File: MvcConfig.java    From jakduk-api with MIT License 5 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    LocaleChangeInterceptor localeInterceptor = new LocaleChangeInterceptor();
    localeInterceptor.setParamName("lang");
    localeInterceptor.setIgnoreInvalidLocale(true);

    registry.addInterceptor(localeInterceptor);
}
 
Example 11
Source File: WebAppConfigurer.java    From ShadowSocks-Share with Apache License 2.0 5 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
	// 添加 计数 拦截器
	registry.addInterceptor(new Interceptor(countSerivce)).addPathPatterns("/**").excludePathPatterns("/webjars/**", "/css/**", "/images/**", "/js/**", "/favicon.ico", "/count");
	// 本地化拦截器
	LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
	localeChangeInterceptor.setParamName("language");
	registry.addInterceptor(localeChangeInterceptor).addPathPatterns("/**");
}
 
Example 12
Source File: DispatcherServletConfiguration.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
protected void addInterceptors(InterceptorRegistry registry) {
    LOGGER.debug("Configuring localeChangeInterceptor");
    LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
    localeChangeInterceptor.setParamName("language");
    registry.addInterceptor(localeChangeInterceptor);
}
 
Example 13
Source File: LocaleConfiguration.java    From jhipster-ribbon-hystrix with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
    localeChangeInterceptor.setParamName("language");
    registry.addInterceptor(localeChangeInterceptor);
}
 
Example 14
Source File: MvcConfig.java    From training with MIT License 4 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    LocaleChangeInterceptor interceptor = new LocaleChangeInterceptor();
    interceptor.setParamName("lang");
    registry.addInterceptor(interceptor);
}
 
Example 15
Source File: LocaleConfiguration.java    From cubeai with Apache License 2.0 4 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
    localeChangeInterceptor.setParamName("language");
    registry.addInterceptor(localeChangeInterceptor);
}
 
Example 16
Source File: LocaleConfiguration.java    From e-commerce-microservice with Apache License 2.0 4 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
    localeChangeInterceptor.setParamName("language");
    registry.addInterceptor(localeChangeInterceptor);
}
 
Example 17
Source File: LocaleConfiguration.java    From tutorials with MIT License 4 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
    localeChangeInterceptor.setParamName("language");
    registry.addInterceptor(localeChangeInterceptor);
}
 
Example 18
Source File: LocaleConfiguration.java    From angularjs-springboot-bookstore with MIT License 4 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
    LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
    localeChangeInterceptor.setParamName("language");
    registry.addInterceptor(localeChangeInterceptor);
}
 
Example 19
Source File: I18nConfig.java    From open-capacity-platform with Apache License 2.0 4 votes vote down vote up
@Bean
public LocaleChangeInterceptor localeChangeInterceptor() {
    LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
    lci.setParamName("lang");
    return lci;
}
 
Example 20
Source File: WebConfig.java    From Spring with Apache License 2.0 4 votes vote down vote up
@Override
public void addInterceptors(InterceptorRegistry registry) {
	final LocaleChangeInterceptor interceptor = new LocaleChangeInterceptor();
	interceptor.setParamName("language");
	registry.addInterceptor(interceptor);
}