Please could someone give me some advice on internationalization best practice for JSF. I know what I am trying to achieve but not the best method. I would appreciate any guidance.
Requirements ============ I want a ResourceBundle accessible to my JSF pages, backing beans and model objects loaded from a properties file. I dont want to load the ResourceBundle for every page or object use, I would like it stored in session scope. The localised resource bundle has to be of the type LC_CC_VC where LC=language, CC=country and VC=variant. I would like to be able to access messages in JSF pages using expression language.
Can anyone advise how I can achieve the above?
Where should I set the Locale in the UIViewRoot? Do I need to set the supported locales in the XML config file? Should I ignore the JSF features and just create my own ResourceBundle and stick it in Session scope? How can I access messages from a resource bundle without having a specific getter?
What would you do?
Thanks for your advice in advance - there are too many options for me to pick the best way to do this.
So far I have tried this route ============================== Extract locale from DB after login Create ResourceBundle in login method of backing bean Store Resourcebundle in session scope
This is OK but it means I cannot use EL to access my messages so I am looking for another solution.
Please ignore the silly face which the website inserted without asking me. It replaced a colon followed by a letter o with this silly symbol.
Varun Khanna
Ranch Hand
Joined: May 30, 2002
Posts: 1400
posted
0
If a view is not associated with a locale explicity, JSF uses "Accept-Language" header in request data from browser to find out the locale to be picked. It compares the header's values with the ones configured in faces-config.xml and if no match is found default locale is selected.
- Varun
Varun Khanna
Ranch Hand
Joined: May 30, 2002
Posts: 1400
posted
0
Originally posted by Chris Gage: Please ignore the silly face which the website inserted without asking me. It replaced a colon followed by a letter o with this silly symbol.
Alternatively, while replying you may checkDisable smilies in this post. option at the bottom of the screen
Ronald Johnson
Greenhorn
Joined: Jan 15, 2007
Posts: 18
posted
0
i am coding a "switch language" into an app, and my idea is that i have a bean that stores the language setting. as default, the Accept-language should be used, i.e. in the bean, i would either returned the user defined lanuage or the value of Accept-language.
how can i read out the value of Accept-language from my java code?
Y Jadhav
Ranch Hand
Joined: Oct 02, 2008
Posts: 37
posted
0
Chris Gage wrote:Please ignore the silly face which the website inserted without asking me. It replaced a colon followed by a letter o with this silly symbol.
CHECK "Disable Smilies ...." option while sending reply...
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
0
Kind of you, but in the future please don't resurrect old and dead topics. Just leave them for what they are and respond to active topics in the listing only.