Announcement Announcement Module
Collapse
No announcement yet.
Problems i18n Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems i18n

    Hello, I am trying to internationalizate a web applicacion. For that, I set up:
    application-context.xml
    Code:
    <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    	    <property name="basename" value="MessagesBundle" />
    	    <property name="cacheSeconds" value="0" />
    	</bean>
    faces-config.xml
    Code:
    ....
    <application>
            <locale-config>
                <default-locale>en_EN</default-locale>
                <supported-locale>en_EN</supported-locale>
                <supported-locale>fr_FR</supported-locale>
                <supported-locale>de_DE</supported-locale>
                <supported-locale>es_ES</supported-locale>
            </locale-config>
            <resource-bundle>
                <base-name>javabeat.net.messages.Messages</base-name>
                <var>msg</var>
            </resource-bundle>
        </application>
    ......
    
    <managed-bean>
    		<managed-bean-name>MessagesBundle</managed-bean-name>
    		<managed-bean-class>org.springframework.context.support.ReloadableResourceBundleMessageSource</managed-bean-class>
    		<managed-bean-scope>request</managed-bean-scope>
    	</managed-bean>

    Messages.bundle which is in /WEB-INF/messages. I think maybe the error is here, in the basename, maybe I must write a hole path, but I am nor sure about this and tryed different options with no succes result.
    Code:
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <f:loadBundle basename="javabeat.net.messages.Messages" var="MessagesBundle"/>
    <html>
        <body>
            <f:view>
                <h:form>
                    <h:outputText value="#{MessagesBundle.email}"/>
                </h:form>  
            </f:view>
        </body>
    </html>
    Severals MessagesBundle_es_ES.properties in different languajes which are also in /WEB-INF/messages

    email=Dirección de correo electrónico

    And in my code, in a loggin.xhtml for instance, I have something like this:

    HTML Code:
    <h:outputText value="#{MessagesBundle.email}"/>
    But I don't get any result when I display the page. What am I doing wrong'?
    Thansk in advance
    Last edited by mujer_esponja; Oct 22nd, 2010, 04:06 AM.

  • #2
    Try to replace

    Code:
    <f:loadBundle basename="Messages" var="msg"/>
    by
    Code:
    <f:loadBundle basename="javabeat.net.messages.Messages" var="msg"/>
    Or even better to put message-bundle in faces-config.xml instead of writing f:loadBundle at every pages.

    And use

    Code:
    <h:outputText value="#{msg.email}"/>
    to getting message.
    Last edited by Slava Semushin; Oct 21st, 2010, 02:05 PM.

    Comment


    • #3
      Or even better to put message-bundle in faces-config.xml instead of writing f:loadBundle at every pages.
      What do you mean with this?? The alternative is still not working, and no error is shown.
      Thanks for your answer

      Comment


      • #4
        BTW, try to eliminate double f:view.

        message-bundle example described here: http://www.laliluna.de/articles/java...-tutorial.html

        Comment


        • #5
          According to your suggestion, I made different changes, but still with no results. I have just edited my question.
          Thanks

          Comment

          Working...
          X