Commit 9e9d39c6 authored by Matija Obreza's avatar Matija Obreza
Browse files

Expose bean Set<String> supportedLocales

parent 632fd4da
......@@ -16,6 +16,9 @@
package org.genesys2.spring.config;
import java.util.HashSet;
import java.util.Set;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -41,4 +44,20 @@ public class SpringProperties {
return propertyPlaceholderConfigurer;
}
@Bean
public static Set<String> supportedLocales() {
final Set<String> supportedLocales = new HashSet<String>();
supportedLocales.add("en");
supportedLocales.add("ar");
supportedLocales.add("de");
supportedLocales.add("fa");
supportedLocales.add("fr");
supportedLocales.add("pt");
supportedLocales.add("ru");
supportedLocales.add("zh");
return supportedLocales;
}
}
......@@ -16,11 +16,12 @@
package org.genesys2.spring.config;
import java.util.HashSet;
import java.util.Locale;
import java.util.Properties;
import java.util.Set;
import javax.annotation.Resource;
import org.genesys2.spring.AddStuffInterceptor;
import org.genesys2.spring.RequestAttributeLocaleResolver;
import org.genesys2.spring.RequestTrackingInterceptor;
......@@ -61,6 +62,9 @@ public class SpringServletConfig extends WebMvcConfigurerAdapter {
@Autowired(required = false)
private RequestTrackingInterceptor requestTrackingInterceptor;
@Resource
private Set<String> supportedLocales;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
super.addResourceHandlers(registry);
......@@ -126,17 +130,6 @@ public class SpringServletConfig extends WebMvcConfigurerAdapter {
@Bean
public RequestAttributeLocaleResolver localeResolver() {
final Set<String> supportedLocales = new HashSet<String>();
supportedLocales.add("en");
supportedLocales.add("ar");
supportedLocales.add("de");
supportedLocales.add("fa");
supportedLocales.add("fr");
supportedLocales.add("pt");
supportedLocales.add("ru");
supportedLocales.add("zh");
// supportedLocales.add("sl");
final RequestAttributeLocaleResolver resolver = new RequestAttributeLocaleResolver();
resolver.setDefaultLocale(new Locale("en"));
resolver.setSupportedLocales(supportedLocales);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment