Matt, Thank you for your valuable advice !!

mraible wrote:
> 
> You should be able to use an HttpSessionAttributeListener (see
> UserCounterListener for an example) to do this.
> 
> http://tinyurl.com/24j7me
> 
> Within your listener, you should be able to add logic that looks up
> the user's locale (or just read it from the User object provided by
> Acegi) and stuff it in the session.  Look at the logic in
> LocaleFilter.java for how to do this:
> 
> http://tinyurl.com/yo6u43
> 
> Of course, you could also just modify LocaleFilter to do this.  If
> you're using 2.x, the easiest way to change filters (at this point) is
> to copy the source and put it into a package in your project - and
> then modify web.xml to point to your package.  The beauty of this
> approach is you should be able to copy the test into your project as
> well.
> 
> Hope this helps,
> 
> Matt
> 
> 
> On 3/28/07, Fan <[EMAIL PROTECTED]> wrote:
>>
>> Matt, thank you for the explaination.
>>
>> I think I need to go futher by extending or changing the ResourceBundle
>> handling, I am thinking of adding a column in the user table to tell
>> which
>> language the user is going to use, by then I should be able to load the
>> specific ApplicationResources.propeties.
>>
>> In short, I wish to load the specific ApplicationResourcess.properties
>> dependent on user login instead of user locale. How  do you think about
>> this
>> ? Any advice ? Or could you please give me a pointer to where should I
>> start
>> with ?
>>
>>
>> mraible wrote:
>> >
>> > On 3/27/07, Fan <[EMAIL PROTECTED]> wrote:
>> >>
>> >> 1) Yes I am using struts as the web framework, I have the following
>> lines
>> >> inside the struts.xml, so how could I change that to make loading two
>> set
>> >> of
>> >> ApplicationResources.properties ? what does this <constant
>> >> name="struts.custom.i18n.resources"
>> value="ApplicationResources,errors"/>
>> >> mean ?
>> >
>> > It means load ApplicationResources.properties, as well as
>> > errors.properties and use the regular ol' locale-resolution logic
>> > provided by ResourceBundle.
>> >
>> > So to add a new one, change it to
>> > value="ApplicationResources,errors,yournewbundle"/>
>> >
>> >>
>> >>     <constant name="struts.devMode" value="false"/>
>> >>     <constant name="struts.locale" value="en"/>
>> >>     <constant name="struts.i18n.encoding" value="UTF-8"/>
>> >>     <constant name="struts.action.extension" value="html"/>
>> >>     <constant name="struts.objectFactory" value="spring"/>
>> >>     <constant name="struts.custom.i18n.resources"
>> >> value="ApplicationResources,errors"/>
>> >>     <constant name="struts.multipart.maxSize" value="2097152"/>
>> >>     <constant name="struts.ui.theme" value="css_xhtml"/>
>> >>
>> >> 2) In fact, I want to have both english & chinese caption/message
>> appear
>> >> on
>> >> the screen at the same time, if that's possible then please give me a
>> >> pointer to where to change it
>> >
>> > You could do this by providing 2 keys in the same i18n bundle - one
>> > for English and one for Chinese.  Or you could write your own i18n tag
>> > to render both from two different bundles.  2 keys is the simplest
>> > solution I can think of.
>> >
>> >>
>> >> 3) Programatically, how to detect the browser locale ? A pointer to
>> that
>> >> part will be appreciated,
>> >
>> > request.getLocale() should work. You can also get the locale from a
>> > ThreadLocale - so you can get the user's locale anywhere in your
>> > application.
>> >
>> >>    How to pass in the locale from the user ?
>> >
>> > Add locale=zh (or something similar) as a parameter on a URL.
>> >
>> > Matt
>> >
>> >>
>> >>
>> >> mraible wrote:
>> >> >
>> >> > On 3/27/07, Fan <[EMAIL PROTECTED]> wrote:
>> >> >>
>> >> >> 1)Is that possible to load two set of
>> ApplicationResources.properties
>> >> ?
>> >> >
>> >> > It depends on the web framework you're using.  If it's Struts, the
>> >> > i18n bundles are specified at the top of struts.xml.
>> >> >
>> >> >>
>> >> >> 2)Is that possible to have two different languages , maybe chinese
>> &
>> >> >> english, being used together in Appfuse 2.0 ?
>> >> >
>> >> > If the keys are not found in the Chinese version, it'll default to
>> >> > ApplicationResources.properties (which is currently English).  So
>> this
>> >> > may be possible - I'm not sure what you're trying to do here.
>> >> >
>> >> >>
>> >> >> 3)How does Appfuse 2.0 chose which ApplicationResource.properties
>> to
>> >> load
>> >> >> ?
>> >> >
>> >> > It uses the browser's locale, or if the user passes in locale=xx, it
>> >> > persists that locale for the duration of the user's session.
>> >> >
>> >> >>
>> >> >> Hope I can get a pointer to which part of the coding I could change
>> to
>> >> >> settle the above mentioned questions ?
>> >> >
>> >> > If I haven't answered your questions, please let me know.
>> >> >
>> >> > Matt
>> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/Possible-to-load-two-set-of-ApplicationResources.properties---tf3473697s2369.html#a9694389
>> >> >> Sent from the AppFuse - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > http://raibledesigns.com
>> >> >
>> >> >
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >> >
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Possible-to-load-two-set-of-ApplicationResources.properties---tf3473697s2369.html#a9694790
>> >> Sent from the AppFuse - User mailing list archive at Nabble.com.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>> > --
>> > http://raibledesigns.com
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Possible-to-load-two-set-of-ApplicationResources.properties---tf3473697s2369.html#a9716120
>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 
> -- 
> http://raibledesigns.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Possible-to-load-two-set-of-ApplicationResources.properties---tf3473697s2369.html#a9734975
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to