7 Replies Latest reply on Jun 9, 2008 5:59 PM by yacin00

    MultiLanguage messages in data base

    yacin00

      Hi,
      i want to store a message in  database (description of product) which i can display in different languages using EL expression.
      is that possible?


        • 1. Re: MultiLanguage messages in data base
          joaobmonteiro

          Hi ig rek,


          You can create a Seam session-scoped component to deal with different languages. For example, you could make a MessagesDatabase component that wraps the way you get the messages. In you case, this component should retrive messages from database and using EL you can invoke 'messagesDatabase.message'.


          It is just an idea!

          • 2. Re: MultiLanguage messages in data base
            zergspirit

            Here's an interesting little tutorial made by Pete to do that, it worked perfectly for me:
            http://in.relation.to/2303.lace

            • 3. Re: MultiLanguage messages in data base
              zergspirit

              Upps, I must have somehow screwed up my link, but the one above was correct. Here's a correct link though:
              Storing your messages in a database

              • 4. Re: MultiLanguage messages in data base
                zergspirit

                Yeah, actually I realized I was a bit off topic, I got fooled by your topic's name.
                Anyway, the thing you want to do isn't too complicated.
                Basically, you'd simply need a Seam component that retrieves the right message for a product.
                You could even do it in a custom EntityHome, adding a method such as 'getProductDescription' that would give the description for the proper language (retrieved thanks to org.jboss.seam.core.Locale.instance().getLanguage()).

                • 5. Re: MultiLanguage messages in data base
                  yacin00

                  thanks guys.
                  may be I wasn't very clear in my first post, and i apologize
                  generally for displaying my messages in different languages , I use EL that retrieves messages from messages.properties, where  I define the messages in two languages, something common i think.


                  the thing that i want to do, is to make in database something that  do a same thing, something like product.description, using INSERT INTO , which refers to the message defined in something like message.properties.
                  i hope it was understandable.


                  I saw the tutorial proposed by Peter, i think it is too complicated for what I want to do, may be I'm wrong.

                  • 6. Re: MultiLanguage messages in data base
                    yacin00

                    I resolved the problem by making a message in messages.properies,(Product.Description)  inserting it by INSERT INTO Product (description) values (Product.Description) and displaying it using

                    #{product.description}

                    .
                    and using localSelector.selectLanguage for changing Language.
                    thank you.


                    • 7. Re: MultiLanguage messages in data base
                      yacin00

                      oops , it was ,


                      #{messages['product.description']}


                      sorry