Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

locales and jsf

 
dan volfman
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i have a few questions about jsf and localization.
assume i have the following definition in faces-config.xml


In my jsf page i use bundle.abc to get the value of abc (which is mapped in labels.properties). i also have labels_de.properties

the question is - what locale is used in in this bundle?

i configured the locales:

but it didnt make the page take the values from labels_de.
only when i define <f:view locale="de_DE"/> in the page, the value is taken from labels_de.properties.
Can someone please explain how this works?

thanks.

 
Ilari Moilanen
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all you don't have to put the view tag to all of your pages. You can put it in a template file and then all your pages that use that template have it defined.

When you define the locale change it to point to a backing bean (or to facescontext) so that it can change dynamically. I for example have it defined like this
so I can change the locale as I want based on the users preferences.

I can explain how it works in more detail if you want (when I have more time).

The reason we need to use the f:view tag at all is not clear to me but maybe somenone here on this forum can explain the technical details >
 
Jose Berardo
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that your browser is sending en_US in its Accept-Language header.
The Accept-Language is the major precedence information about locales. To use another you need the f:view or programatically change the ViewRoot's locale attribute:



I'm having a problem closed to yours. If you solve yours, please take a look at mine: http://www.coderanch.com/t/515506/JSF/java/problems-JSF




 
Brendan Healey
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Try it without the country specific detail. You're definitely on the right track, perhaps your
browser settings are incorrect (preferred languages).

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic