• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

I18n problems with JSF

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


 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I made a mistake of opening two threads for the same problem.

You can read more about my problem at this thread:
https://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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic