Question

I'm working in an application with i18n and this application works nice in my development environment(Windows) but, when I try deploy in Linux everything seems ok, until I do a request and receive the message

No message found under code 'message.header.inicio' for locale 'pt_BR'.

I had two files

  • messages_pt_BR.properties
  • messages_en.properties

After much research I changed messages_pt_BR.properties to messages.properties and set fallbackToSystemLocale to false but I continue receiving the same error. Someone can help me ?

Follow my dispatcher-servlet.xml

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:webflow="http://www.springframework.org/schema/webflow-config"
xsi:schemaLocation="
    http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
    http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd">

<context:property-placeholder system-properties-mode="OVERRIDE" />
<context:component-scan base-package="br.com.company" />

<!-- i18n retirado de http://www.mkyong.com/spring-mvc/spring-mvc-internationalization-example/ -->
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver"/>

<mvc:interceptors>
    <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
        <property name="paramName" value="language" />
    </bean>
</mvc:interceptors> 

<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <property name="basename" value="classpath:/br/com/company/web/i18n/messages"/>
    <property name="defaultEncoding" value="ISO-8859-1"/>
    <property name="fallbackToSystemLocale" value="false"/>
</bean>
<!-- referencias: http://www.mkyong.com/tutorials/spring-mvc-tutorials/ -->

<mvc:annotation-driven />
<mvc:resources location="/resources/" mapping="/resources/**" />

<bean id="viewResolver"
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
    <property name="order" value="1" />
    <property name="prefix" value="/WEB-INF/views/" />
    <property name="suffix" value=".jsp" />
</bean>

<import resource="applicationContext-flow.xml"/>

Was it helpful?

Solution

I found a work around for my problem. In the spring tag I added the text property so even in my environment that the application shows the error. I have a fallback of one fallback....

<spring:message code="welcome.springmvc" text="default text" />

This is not a better solution, but works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top