8 Replies Latest reply on Oct 29, 2007 12:19 PM by Adrian Mitev

    Internationalization in RichFaces

    Steve Whatmore Newbie

      Good afternoon,

      Can anyone point me at a good RichFaces example application that includes internationalization.

      Alternatively, if you could highlight the proper approach / best practices (sample code) for I18N'ing a RichFaces application that would be appreciated as well.

      Thanks in advance.


        • 1. Re: Internationalization in RichFaces
          Tomislav Jakopec Novice



          some jsp page
          <r:panelBarItem label="#{messages['zajednicke.akcija']}">

          seam default locale selector

          <h:selectOneMenu value="#{localeSelector.localeString}"
           <f:selectItems value="#{localeSelector.supportedLocales}" />
           <a:support event="onchange" action="#{localeSelector.select}">
           <t:updateActionListener value="#{localeSelector.localeString}"
           property="#{oper.postavkeOperatera.jezik}" />

          • 2. Re: Internationalization in RichFaces
            Tomislav Jakopec Novice

            in WEB-INF/classes should be properties files



            and that files look like this

            autorizacija.autorizacija = Authorization
            autorizacija.autoriziraj = Authorization
            autorizacija.dobrodosli = Welcome!
            autorizacija.jezik = Language
            autorizacija.lozinka = Password
            autorizacija.operater = Operater

            autorizacija.autorizacija = Autorizacija
            autorizacija.autoriziraj = Autoriziraj
            autorizacija.dobrodosli = Dobrodo\u0161li!
            autorizacija.jezik = Jezik
            autorizacija.lozinka = Lozinka
            autorizacija.operater = Operater

            under Eclipse use ResourceBundle editor plugin

            • 3. Re: Internationalization in RichFaces
              Steve Whatmore Newbie

              Good morning,

              First, thanks for the response.

              I followed your instructions, placing a locale-config if the faces config file and created the corresponding message_XX.properties, however, it does not seem to be working.

              Here is my FACES / JSP page

              <?xml version="1.0" encoding="ISO-8859-1" ?>
              <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="https://ajax4jsf.dev.java.net/ajax" version="2.0">
              <html xmlns="http://www.w3.org/1999/xhtml">
               <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
               <h:outputText value="#{messages['administration.title']}"/>
              <h1><h:outputText value="#{messages['administration.title']}"/></h1>
              <a href="administration/menu.jspx"><h:outputText value="#{messages['administration.menu']}"/></a>

              which results in a blank page since the I18N messages are not being displayed properly.

              Any thoughts?

              Thanks in advance.


              • 4. Re: Internationalization in RichFaces
                Steve Whatmore Newbie

                Good afternoon,

                I added the following line

                <a4j:loadBundle basename="messages" var="msgs"/>

                immediately following the


                tag and of course referenced the messages via

                <h:outputText value="#{msgs['administration.title']}"/>

                which solved the problem.

                Is this the correct way / "best practice" method in which to approach I18N?

                Thanks in advance.


                • 5. Re: Internationalization in RichFaces

                  Yes, that is correct approach.

                  • 7. Re: Internationalization in RichFaces
                    Brian Parkinson Newbie

                    Hi all -

                    Thanks for the above info - am now supporting internationalization in RichFaces using <a4j:loadBundle>

                    My web page contains:

                    <f:view locale="en>...

                    and if I change this to:

                    <f:view locale="fr">...

                    it all works.

                    My question is - how can I change this in code - I'd like to be able to change the locale "on the fly".

                    Any help is appreciated.



                    • 8. Re: Internationalization in RichFaces
                      Adrian Mitev Master

                      You can change the locale on the fly but don't use <f:view locale="fr">. You can set the locale using