Я изменил языковой стандарт по умолчанию в конфигурации весны, но весна всегда использует messages_en.properties вместо messages.properties. Кажется, что Spring игнорирует мой выбор языка.Spring не использует источники по умолчанию locale
определенные locases:
messages.properties
messages_en.properties
конфигурации Пружина: приложения context.xml
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<property name="defaultLocale" value="cs"/>
</bean>
<bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang" />
</bean>
<bean name="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>messages</value>
</list>
</property>
<property name="defaultEncoding" value="UTF-8" />
</bean>
сервлет-context.xml
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**" />
<exclude-mapping path="/admin/**"/>
<exclude-mapping path="/image/**"/>
<exclude-mapping path="/ajax/**"/>
<beans:bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
</mvc:interceptor>
</mvc:interceptors>
В JSP странице
<spring:message code="csn.terminology.csnId" />
<p>Current Locale : ${pageContext.response.locale}</p>
<!-- output is 'cs', but messages are from messages_en.properties file -->
В проекте используется Spring Framework 3.2.4 Заранее спасибо за вашу помощь.
Можете ли вы показать, как вы используете расслоения? –
@Peter Jurkovič Как вы решили эту проблему? У меня такая же проблема http://stackoverflow.com/questions/26770383/localization-not-working-in-spring-4 – RanPaul