*
The moose likes JSF and the fly likes internationlization in facelet seems not working well Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "internationlization in facelet seems not working well" Watch "internationlization in facelet seems not working well" New topic
Author

internationlization in facelet seems not working well

reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
I have a web app built by JSF2, with English and French versions of pages.
I created a wrapper.xhtml as the template page, defined header, content, and footer pages

Then I created a helper page that uses this wrapper as the template.


'msgs.glossaryLink' contains the links for helper pages for English and French, which points to 2 different pages in different path

If I clicks from other page to come to this help page, it's loaded fine. But when I clicks the link for switching language link (in the header) in this helper page alone, the content portion, which is the file for English or French, is loaded one step behind, or I have to refresh the page in order for the content to match the header's locale.

Does this mean I cannot do internationlization in the facelet itself, or what's wrong with this behavior?

Thanks.


SCJA, SCJP5.0, SCBCD, SCWCD
Ilari Moilanen
Ranch Hand

Joined: Apr 15, 2008
Posts: 198
Can we see how you change the locale? Maybe there is something wrong in your code? Remember that you have to change the locale both locally (page level) and globally (in facescontext) in order to have the change take effect immediately. I know that it is a pain in the ass to change the locale in JSF and I have myself accomplished in doing it by following an example (do not remember the name of the book I read it from). Read for example this thread:
http://www.coderanch.com/t/515506/JSF/java/problems-JSF
reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
Here is the code for the locale class



The code is working for the header portion, not the content portion which is below it and specified by
<ui:define name="content">
<ui:include src="#{msgs.glossaryLink}"/>
</ui:define>

where #{msgs.glossaryLink} is either glossaryLink=/template/static/glossary/glossary.html or glossaryLink=/template/static_fr/glossary/glossary.html

Thanks
Ilari Moilanen
Ranch Hand

Joined: Apr 15, 2008
Posts: 198
Your problem is such a specific one that it might just be that there is a bug in the implementation you use...

But just to make sure that you have set everything correct do you have f:view inside your wrapper.xhtml that is defined similar to this?
reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
Yes, I have that in the wrapper page.
Actually I have other pages working for the content that contains #{msgs.key} inside content. But it's not working for the key as part of <ui:define name="content"> itself as I stated above. So I was wondering if facelet itself would have some problem?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: internationlization in facelet seems not working well