myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Werner Punz <>
Subject Re: is there any tutorial or sample for Myface localization ?
Date Fri, 30 Dec 2005 00:18:52 GMT
yes, the view root has a certain locale setting:

<f:view locale="#{languagebean.currentLanguage}">

works for instance with the bean delivering the current locale
(thats the way I do it in my current project which needs
dynamic locale switching upon a given request value).
There is another way as well (I have only vage info about this in my 
mind, Thomas Spiegl once showed it to me), you can adjust the locale 
somewhere in the servlet request or servlet session
and jsf adjusts to that value automatically on session scope.


Legolas Woodland wrote:
> Werner Punz wrote:
>> Legolas Woodland wrote:
>>> Hi
>>> Thank you for reading my post.
>>> is there any sample which i can learn localizing JSF application from 
>>> it ?
>>> my questions are
>>> 1-where to put the .properties file , in Struts i could define them 
>>> in struts-config.xml  but i do not have any clue about jsf
>>> 2-how to call key from .properties file ? in struts <bean:message  , 
>>> but  is jsf i do not know
>>> 3-does it needs some specefic declaration to make a jsf application 
>>> localized ?
>> It is much easier than in
>> Struts (like most stuff in JSF), you do not have to defined it at all 
>> in the config file.
>> The trick is that you have a tag for this stuff and thus can put
>> as many internationalisation files as you like into your forms:
>> f:loadbundle does the trick
>> it is way more flexible that way because you can add and remove bundles
>> on the fly as you like it.
> Hi
> Thank you for reply , i create all bundles , and i add them in
> faces-config.xml like the following
> ...........
>   *<application>
>     <locale-config>
> <default-locale>fr</default-locale>
> <supported-locale>en_US</supported-locale>
>   </locale-config>
>   </application>
>   ..............
> *when  i change the browser locale to fr it shows the fr resources , (it 
> must show the fr in that case) and when my browser locale is  en_US  , 
> it shows englishe resources , is it possible to force the jsf 
> application to use an specefic locale until user change the locale by 
> pressing some button.*
> *thank you.
> BTW : how i can change the locale ?

View raw message