i want to implement an internationalisation bean for my application for three language( french, english ,arabe).

the code of internationalisation bean:

public class InternationalisationBean implements Serializable {

private static final long serialVersionUID = 1L;
private Locale locale;
private String langue;

public void changerLangue() {
// mise en forme de la langue
int index=this.langue.indexOf("_");
String choixLangue=this.langue.substring(0,index);
String pays=this.langue.substring(index+1);
locale=new Locale(choixLangue,pays);
}else {
locale=new Locale(this.langue);
// chargement dynamique de la langue
UIViewRoot viewRoot=FacesContext.getCurrentInstance().getView Root();
FacesContext.getCurrentInstance().getApplication() .setDefaultLocale(locale);
// retourner automatiquement sur la page appelante
FacesContext context=FacesContext.getCurrentInstance();
String viewId= context.getViewRoot().getViewId();
javax.faces.application.ViewHandler handler = context.getApplication().getViewHandler();
UIViewRoot root= handler.createView(context, viewId);


public Locale getLocale() {
return locale;

public void setLocale(Locale locale) {
this.locale = locale;

public String getLangue() {
return langue;


the code of the template xhtml is:

<h:form prependId="false">

<h:outputText value="#{bundle.header}: " />
<p:selectOneRadio id="options" value="#{internationalisationBean.langue}">
<f:selectItem itemLabel="Francais" itemValue="fr" />
<f:selectItem itemLabel="Anglais" itemValue="en" />
<f:selectItem itemLabel="Arabe" itemValue="ar" />

<p:commandButton type="submit" id="submitLangage" value="Enregistrer"
action="#{internationalisationBean.changerLangue() }" ajax="false" />

my problem is with the arabic language if i chose it and i refrech the current page i get the language before the chosing arabic and no problem with english and french if i chose one of them the language of the application still configured during the run

help me please