2014-04-02 51 views
0

我在使用i18n的應用程序中工作,此應用程序在我的開發環境(Windows)中工作良好,但是當我嘗試在Linux中部署時,一切似乎都沒問題,直到我做出請求並接收消息ReloadableResourceBundleMessageSource.fallbackToSystemLocale無法正常工作

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

我有兩個文件

  • messages_pt_BR.properties
  • messages_en.properties

經過大量研究,我將messages_pt_BR.properties更改爲messages.properties並將fallbackToSystemLocale設置爲false但我繼續收到相同的錯誤。有人可以幫助我嗎?

按照我的調度員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"/> 

回答

0

我發現周圍的工作我的問題。在spring標籤中,我添加了文本屬性,所以即使在我的環境中,應用程序也會顯示錯誤。我有一個後備回退....

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

這不是一個更好的解決方案,但工程。