3 Replies Latest reply on Oct 8, 2010 6:28 AM by lvdberg

    dynamic messages properties

    tienlantri

      I have this in a file xhtml


      <h:outputLabel value="#{myTitle}"/>



      where myTitle is a String outjected from Action class and it's dynamic. Somewhat like this:




      if (Util.CONSIGNE_PARAM.equals(myParam)) {
                  myTitle = "Liste des consigne";
              } else if (Util.EFTCO_PARAM.equals(myParam)) {
                  myTitle = "Liste des eftco";
              }



      The problem is that my application is internationalized. So is there any way to manipulate myTitle in java? or even in xhtml?


      Thanks,
      Tina





        • 1. Re: dynamic messages properties
          lvdberg

          Hi,


          We needed such functionality because the messagesXX file need to be adapted for every new string and the server need to be restarted to be effective.



          I've made an Application scoped bean which contains text and its translation. It basically does the same as the messages component, but I use a table to store the translations, which makes it more dynamic.



          Leo

          • 2. Re: dynamic messages properties
            cash1981

            Why cant you use



            Messages.instance().get("someKey")



            • 3. Re: dynamic messages properties
              lvdberg

              Hi,


              Seam uses the messagesXX.properties and other static files, which can't be changed dynamically. So if you need to translate a new string it is not really practical to restart your server, so the application understand the new string, hence my suggestion for a more dynamic translator.


              Leo