aspose file tools*
The moose likes JSF and the fly likes I18n problems with JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "I18n problems with JSF" Watch "I18n problems with JSF" New topic
Author

I18n problems with JSF

Jose Berardo
Greenhorn

Joined: Oct 28, 2010
Posts: 9
Hello,

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:
bundles.messages_en.properties
bundles.messages_pt_BR.properties
bundles.messages_fr.properties

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.

Any help?

Sorry about my poor english.


Ilari Moilanen
Ranch Hand

Joined: Apr 15, 2008
Posts: 198
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.

I used these notes when I made this construct
http://www.coreservlets.com/JSF-Tutorial/jsf2/index.html#Properties

I do not use internationalized images in my application so I do not know if this helps with your problem but maybe at least you have some ideas where to start solving the problem.
Jose Berardo
Greenhorn

Joined: Oct 28, 2010
Posts: 9
I made a mistake of opening two threads for the same problem.

You can read more about my problem at this thread:
http://www.coderanch.com/t/515515/JSF/java/Override-request-headers

You will see why I'm using message-bundle.

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.

Thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I18n problems with JSF