I'm having problems with my JSF pages that I simply don't find the answer anywhere.
I have a page with f:view to localize my message and my resources (some graphicImages and commandButtond with image attribute).
The user himself is able to choose the locale from a list of available locales filled out on a selectOneMenu from reading supported-locale tags at faces-config.
When the user chages the SelectOneMenu, all the localized messages changes to the new language, but the images don't.
I have these files:
All of them have the line:
(or english, or french)
In my faces-config.xml:
I've tested with different browsers with different Accept-Language and I can see images from english, portuguese and french directories. The problem is the user input. When he changes, only my resource bundles (which have been loaded by resource-bundle tag or f:loadBundle) change.
I've tested with which brought me another problem (I had to refresh the after changing the selectOneMenu). Now I'm using: and in my bean:
I solved the refresh problem but still have the images based only on Accept-Language browsers head.
Sorry about my poor english.
Joined: Apr 15, 2008
In a application I use I have a loginUser bean with these methods:
and although, I admit, the multiple setter implementation is poor the basic principle of both using the local and global locales is visible. Maybe this can help you with your refresh problem?
I don't know if you are using JSF 1 or 2 but it is not recommended to use message bundle but resource bundle. So I have this defined in faces-config.xml
where messages is the name of the bundle i.e. messages.properties, messages_fi.properties, messages_en.properties and so on.
About I18N, I know how it is possible getting localized message and even external resources (like images and css), but I'd like to know if it is possible using the JSF native mechanism of using javax.faces.resource.localePrefix.
My big problem is that I am a Java teacher and I am making video classes about JSF. Maybe I should say that there is a bug over this approach, but I need to take care and must be sure about it.