I developed one spring boot microservice application using jhipster tool and we have one quotation.html form it contains name and details of the product I am trying to apply langauage translations to the name and details labels based user language
for that i made changes in these classes
@Configuration
public class LocaleConfiguration implements WebMvcConfigurer {
@Bean
public LocaleResolver localeResolver() {
SessionLocaleResolver slr = new SessionLocaleResolver();
slr.setDefaultLocale(Locale.US);
return slr;
}
@Bean
public LocaleChangeInterceptor localeChangeInterceptor() {
LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
lci.setParamName("lang");
return lci;
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(localeChangeInterceptor());
}
}
added language messages files at this location
i am sending user language key as request param like this
localhost:8080/api/pord/quotation?lang=de
based on this lang value it shoud read keys from respective messages file
Note: The issue is it is always reading language keys from messages_en.properties file
sample quotation.html file
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<body>
<div class="page-content container-fluid">
<div class="title">
<h3>
<center>
<th:block>
<span th:text="#{invoice.quotation}"></span >
</th:block>
</center>
</h3
</div>
</body>
</html>