[Struts 1.1] : Load a particular resource bundle

Discussion in 'Java' started by Dov MORYUSEF, Mar 27, 2005.

  1. Dov MORYUSEF

    Dov MORYUSEF Guest

    Hi to all,

    First, excuse my bad english ;-)

    I would like to know if there is a simple way to load in a Struts web
    application a particular resource bundle depending of the user connected ?

    For example, in my application, i've defined 2 resources properties
    files (resources1.properties and resources2.properties) which contains
    the same messages keys (but of course different messages for the same
    key). In this application, two kind of users can connect (user1 and
    user2). I would like to load resourcesX.properties when userX connects
    .... Is it possible ?

    Thanks a lot for your answers

    Dov
     
    Dov MORYUSEF, Mar 27, 2005
    #1
    1. Advertising

  2. Dov MORYUSEF

    Ron de Waard Guest

    Dov MORYUSEF <> wrote in message news:<4246fd12$0$28305$>...
    > Hi to all,
    >
    > First, excuse my bad english ;-)
    >
    > I would like to know if there is a simple way to load in a Struts web
    > application a particular resource bundle depending of the user connected ?
    >
    > For example, in my application, i've defined 2 resources properties
    > files (resources1.properties and resources2.properties) which contains
    > the same messages keys (but of course different messages for the same
    > key). In this application, two kind of users can connect (user1 and
    > user2). I would like to load resourcesX.properties when userX connects
    > ... Is it possible ?
    >
    > Thanks a lot for your answers
    >
    > Dov

    The whole idea about resource bundles is internationalisation, so by
    switching locales you get another text using the same key. Do you mean
    by user# the language of the user?

    Normally you define messages.properties in struts-config.xml and
    having files with locale extensions containing the keys per language,
    e.g. messages_en.properties for english, messages_de.properties for
    german. Which language will be choosen depends on the language
    settings of the browser. Or you can switch locale by using setLocale()
    in the execute method of an Struts Action object.

    Hope this helps, Ron.
     
    Ron de Waard, Mar 29, 2005
    #2
    1. Advertising

  3. Dov MORYUSEF

    MC Guest

    Ron de Waard a écrit :

    > Dov MORYUSEF <> wrote in message news:<4246fd12$0$28305$>...
    >
    >>Hi to all,
    >>
    >>First, excuse my bad english ;-)
    >>
    >>I would like to know if there is a simple way to load in a Struts web
    >>application a particular resource bundle depending of the user connected ?
    >>
    >>For example, in my application, i've defined 2 resources properties
    >>files (resources1.properties and resources2.properties) which contains
    >>the same messages keys (but of course different messages for the same
    >>key). In this application, two kind of users can connect (user1 and
    >>user2). I would like to load resourcesX.properties when userX connects
    >>... Is it possible ?
    >>
    >>Thanks a lot for your answers
    >>
    >>Dov

    >
    > The whole idea about resource bundles is internationalisation, so by
    > switching locales you get another text using the same key. Do you mean
    > by user# the language of the user?
    >
    > Normally you define messages.properties in struts-config.xml and
    > having files with locale extensions containing the keys per language,
    > e.g. messages_en.properties for english, messages_de.properties for
    > german. Which language will be choosen depends on the language
    > settings of the browser. Or you can switch locale by using setLocale()
    > in the execute method of an Struts Action object.
    >
    > Hope this helps, Ron.

    Thans Ron for your answer.

    I've defined two users (administrator and developer) which have their
    own messages.properties file (respectively messageAdmin.properties and
    messageDeveloper.properties). This 2 users access the sames jsp and i
    would like to load messageAdmin.properties file when administrator
    connects and messageDeveloper.properties file when developer connects.
    It's independant of i18n (users have the same locale) and so I would
    like to know if it possible ?

    Thanks a lot

    Dov
     
    MC, Mar 29, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kent Tong

    i18n using resource bundle

    Kent Tong, Jul 15, 2003, in forum: Java
    Replies:
    2
    Views:
    935
    Kent Tong
    Jul 16, 2003
  2. Mike Landis

    Reloading resource bundle

    Mike Landis, Oct 22, 2003, in forum: Java
    Replies:
    0
    Views:
    460
    Mike Landis
    Oct 22, 2003
  3. Taji

    Resource Bundle

    Taji, Jul 29, 2004, in forum: Java
    Replies:
    1
    Views:
    449
    Roedy Green
    Jul 29, 2004
  4. Replies:
    0
    Views:
    453
  5. William  Cole
    Replies:
    1
    Views:
    749
    Ryan Dillon
    Mar 3, 2005
Loading...

Share This Page