[Struts 1.1] : Load a particular resource bundle

D

Dov MORYUSEF

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
 
R

Ron de Waard

Dov MORYUSEF said:
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.
 
M

MC

Ron de Waard a écrit :
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top