Reply To: I18n approach: Language in URL

Splash Forums Rewrite Users I18n approach: Language in URL Reply To: I18n approach: Language in URL


Hi there.

Sorry for the very late reply. Regarding your CurrentViewLanguage implementation: I typically do it differently. I basically create a request scoped bean which get the value of the path parameter and then provides a Locale which I use to configure the ViewRoot for that locale. So basically something like this:

public class LocaleBean {

  private String lang;

  public String getLang() {
    return lang;

  public void setLang(String lang) {
    this.lang = lang;

  public Locale getLocale() {
    return new Locale(lang);


And then in the main template:

<f:view locale=#{localeBean.locale}>


That works pretty well. Rewrite assigns the lang parameter BEFORE the JSF lifecycle starts and when JSF kicks in, it gets the correct locale from the LocaleBean.