2 Replies Latest reply on Nov 6, 2008 5:19 PM by joblini

    LocaleSelector always returns locale

    nimo22

      I use this:


      <h:outputText value="#{localeSelector.locale}" />
      <h:outputText value="#{localeSelector.localeString}" />
      <h:outputText value="#{localeSelector.language}" />



      and it returns always the locale, that means for example: 'en' instead of 'English'.


      How can I get 'English' instead of 'en' ?


      (I do not want to iterate trough LocaleSelector.instance().getSupportedLocales() to get the value)

        • 1. Re: LocaleSelector always returns locale
          nimo22

          When I use this:


          <h:outputText value="displayLanguage: #{facesContext.externalContext.requestLocale.displayLanguage}" />




          then my display Language in fact not the language which I have choosen from Seams Locale Selector.


          For example:


          I select french, then I acceept that 



          <h:outputText value="displayLanguage: #{facesContext.externalContext.requestLocale.displayLanguage}" />




          returns french, but it always returns the browsers-language and not the language of my websystem.


          I tried to use



          <h:outputText value="#{localeSelector.localeString}" />




          but it gives me only the key (fr) instead of french.


          Any Ideas?

          • 2. Re: LocaleSelector always returns locale
            joblini

            Try this:


            Locale locale = getFacesContext().getViewRoot().getLocale();
            System.out.println("locale="+locale);