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

internationlization in facelet seems not working well

 
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
https://coderanch.com/t/515506/JSF/java/problems-JSF
 
reubin haz
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 287
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic