anonymous wrote : how do you acoomplish following:
|
| Every time a user hits my seam application he`s or her`s locale is set to
ee? Seam offers component level default locale, but how to go in session level
locale?
I haven't looked at the latest Seam support for the various locales. Most
likely I will have to refactor my code to use the Seam approach. In my
implementation I had to extend the JSF ViewHandler and over ride the
caclulateLocale method. Based on a property in session context indicating the
user's chosen locale one can then return the desired locale. Something like the
following (this is just code from memory... not tested) (UserEnvironment might
contain useful information such as the users roles, locale, preferred view
options etc. populated after login ):
| public class I18nViewHandler extends ViewHandler {
| ....
| @Override
| public Locale calculateLocale(FacesContext arg0) {
| Locale locale = null;
| userEnvironment =
(UserEnvironment)Component.getInstance("userEnvironment",true);
| //use the userEnvironment value
| locale = userEnvironment.getLocale();
| if (locale != null) {
| return locale;
| } else {
| return baseViewHandler.calculateLocale(arg0);
| }
| }
| ......
|
Obviously you have to register this new viewhandler in you faces-confic.xml:
| <application>
| <message-bundle>nap</message-bundle>
| <locale-config>
| <default-locale>en</default-locale>
| <supported-locale>af</supported-locale>
| <supported-locale>zu</supported-locale>
| </locale-config>
|
<view-handler>csir.utils.viewhandler.I18nViewHandler</view-handler>
| </application>
|
Regards
Louis
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3935403#3935403
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3935403
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user