Si, creo que ya lo hago. Te muestro las partes de codigo haber si sirve de ayuda. Ya nose que mas probar :S
En la .JSP
Código:
....
<body>
<f:view locale="#{language.localeCode} ">
<div class="container" id="container">
....
<h:form>
<h:commandLink action="#{language.englishAction()}" immediate="true">
<img src="Images/Idiomas/english.jpg" width="40" height="25" style="position:relative;left:960px;">
</h:commandLink>
<h:commandLink action="#{language.spanishAction()}" immediate="true" >
<img src="Images/Idiomas/spanish.jpg" width="40" height="25" style="position:relative; left:960px;">
</h:commandLink>
<img src="Images/Help.png" width="30" height="30" style="position:relative; left:960px; top:3px" title="<h:outputText value="#{msg['help-language']}"/>">
</h:form>
....
Y las funciones las tengo declaradas en la clase LanguageBean.java
Código:
import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;
@ManagedBean(name="language")
@SessionScoped
public class LanguageBean implements Serializable{
private static final long serialVersionUID = 1L;
private String localeCode="en";
public String englishAction(){
FacesContext context= FacesContext.getCurrentInstance();
context.getViewRoot().setLocale(Locale.ENGLISH);
setLocaleCode("en");
return null;
}
public String spanishAction(){
FacesContext context= FacesContext.getCurrentInstance();
context.getViewRoot().setLocale(new Locale("es"));
setLocaleCode("es");
return null;
}
public String getLocaleCode() {
return localeCode;
}
public void setLocaleCode(String localeCode) {
this.localeCode = localeCode;
}
}