2 Replies Latest reply on May 5, 2012 3:31 AM by omid pourhadi

    Changing a locale when a user is logged in.

    Mats Karlsson Newbie

      Hello everyone!

      I have an application that is pretty much as the default application you get when making a new Seam project in JBoss Developer Studio (a login page and a main page). At the top I have two flags that calls localeSelector.selectLanguage('en') and localeSelector.selectLanguage('no'). In WEB-INF/classes i have messagesen.properties and messagesno.properties.
      Now to my problem. When I click on one of the flags before I login everything works fine, all texts are exchanged and you can change the locale in the main page aswell. However, if I just login and then try to change the locale the texts just comes up as keys.
      I have understood that the locale is user session driven, but is there a way to have this implemented as I want?
      Another thing. If I startup JBoss and change the locale once before I login and then logout and thereafter log back in again with a different user, the locale works fine in the main page aswell. It is however not possible to get the right texts if I once try to change the locale for the first time in the main page (after JBoss have started) then logout and then try to set the locale on the login page. The bundle doesn't seems to be loaded at all.

      Any help is appreciated!

        • 1. Re: Changing a locale when a user is logged in.
          Sergio Angelo Newbie



          Did you fix this problem already ? Please let me know, since we're having the same problem.

          • 2. Re: Changing a locale when a user is logged in.
            omid pourhadi Newbie

            I solved this problem by raising an event when user loggedIn



            public class ThemeLocaleController implements Serializable
                @In(value = "org.jboss.seam.international.localeSelector")
                LocaleSelector localeSelector;
                @In(value = "org.jboss.seam.theme.themeSelector")
                ThemeSelector themeSelector;
                private Log log;
                public void changeThemeByLocale()
                    log.info("Changing Theme For " + localeSelector.getLocaleString() + " Locale");
                    if (localeSelector.getLocaleString().equalsIgnoreCase("fa"))