Skip to main content

JSF - Facelets - How to change locale?

3 replies [Last post]
rsoika
Offline
Joined: 2006-12-09

hi,

I am a little bit helpless. I try to change the user locale (Language) used in my Web application independent form the users browser and OS settings. But it did not work.

I have a typical faces-config.xml with locale support for english (default) and german (de):

en
en
de

In my facelets template file I try to set the locale fixed to 'en'

But my application shows always the german (de) resources.
I did not understand why I cannot change the locale in a view tag to a fixed value

I am using facelets 1.1.14
and also RichFaces 3.2.1.GA

Thanks for any help.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
burriad
Offline
Joined: 2009-07-07

I don't know if it has an impact on your problem, but you shouldn't repeat the default locale in the list of supported locales. Deleting the default properties file is definitely a bad idea, as you are deleting your fallback file...

rsoika
Offline
Joined: 2006-12-09

it seems that the

only work if a ressource bundle with the locale sufix '_en' is provided.
Everything works now if I provide 3 ressouce files:

global_en.properties
global_de.properties
global.properties

global.properties and global_en.properties are identically!
But if I delete the global_en.properties file always the global_de.properties file wins before the default properties.
I did not expect such a behavior :-(

wienczny
Offline
Joined: 2007-03-12

Did you try to delete the global.properties? Tried that on my project an everthing seems to work as expected.