2 Replies Latest reply on Dec 20, 2006 10:05 AM by rengar

    Internatinalization: messages only default messages.properti

    rengar

      Two messages.properties :

      messages.properties
      ---------------------------
      ChangeLanguage=Change
      
      ###########################
      
      messages_es.properties
      ------------------------------
      ChangeLanguage=Cambiar
      
      


      In faces-config.xml :

       <application>
       <message-bundle>messages</message-bundle>
       <view-handler>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</view-handler>
       <locale-config>
       <default-locale>es</default-locale>
       <supported-locale>en</supported-locale>
       </locale-config>
       </application>
      


      In xhtml page :

       <h:form id="selectLanguage">
       <h:selectOneMenu value="#{localeSelector.language}">
       <f:selectItems value="#{localeSelector.supportedLocales}"/>
       </h:selectOneMenu>
       <h:commandButton action="#{localeSelector.select}" value="#{messages['ChangeLanguage']}"/>
       </h:form>
      


      -Combobox shows 2 : español, English --> OK

      -If I change to English --> Button #{messages['ChangeLanguage']} shows "Change" --> OK

      -If I change to Spanish --> Button #{messages['ChangeLanguage']} shows "ChangeLanguage" --> ERROR

      what is the problem?

      Any idea?

        • 1. Re: Internatinalization: messages only default messages.prop
          davidalves

          Have you tried to use the: messages_en.properties name for the english messages file?

          • 2. Re: Internatinalization: messages only default messages.prop
            rengar

            Already work!!

            But when change language in other action in the same page catch old language, that have it before, with method "Locale.instance().getLanguage()"

            I explain :

            1º Default "es" -> Combox "español", messages_es, Locale.instance().getLanguage() = "es"
            2º Change "en" -> Combox "English", messages_en, Locale.instance().getLanguage() = "es"
            3º Change "es" -> Combox "español", messages_es, Locale.instance().getLanguage() = "en"
            4º Change "en" -> Combox "English", messages_en, Locale.instance().getLanguage() = "es"
            .
            .
            .
            .



            How change language before enter in my action?