• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

locales and jsf

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 >
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: https://coderanch.com/t/515506/JSF/java/problems-JSF




 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic