This question is a follow - up of the older Language switcher implementation in JSF 2.
The substance of the question is still valid, although PrimeFaces has released some newer builds, and my JSF knowledge is a bit better than before.
To summarize, I have a single xhtml page, fully ajaxified.
The language switcher is this:
<h:form id="selectLanguage" >
<p:commandLink action="#{languageSwitcher.setLanguage('it')}" rendered="#{languageSwitcher.language!='it'}" >
<h:graphicImage library ="images" name="it.gif" title="it" />
</p:commandLink>
<p:commandLink action="#{languageSwitcher.setLanguage('en')}" rendered="#{languageSwitcher.language!='en'}" >
<h:graphicImage library ="images" name="en.gif" title="en" />
</p:commandLink>
</h:form>
I want that when it
is chosen, only the en
flag is displayed, and viceversa. And I want that all the stuff in the web page is updated with the Resource Bundle translations.
In particular, I have some p:dialog
S whose header attributes need to be updated as well.
The dialog forms are inside each dialog:
<p:dialog header="#{msgs.myHeader}" ... >
<h:form .... />
</p:dialog >
The rest of the page is a <p:layout>
containing some layoutUnits. Each layoutUnit
contains a form with other components that need to be translated as well.
LanguageSwitcher is a SessionScoped
JSF Managed Bean
.
I have tried all of the following ways:
<f:ajax render="@all" />
inside thep:commandLink
bracesupdate="@all"
attribute insidep:commandLink
<p:ajax update="@all" />
inside thep:commandLink
braces
Unfortunately, none of them works.
I have tried with @all
, although I am available to insert the ids of the forms, they are not so many. Problem is that the dialog headers are not updated in this way.
I am using PrimeFaces 3.4.1 - Mojarra 2.1.13