Chapter 9. Seam Internationalization

Each user login session has an associated instance of java.util.Locale (available to the application as a component named locale). In order to set the locale manually via the application user interface, you should change the following properties of the localeSelector component: language, country, variant.

The current locale for the Flex application can be set during the compilation process with the help of the compiler option, for example "-locale en_US":

See "mx.resources.Locale" for more details.

The code sample below shows how the current client locale can be received and then set to use in Seam:


<mx:Script>
    <![CDATA[
        import mx.resources.Locale;

        private function setLocale():void
        {
            var l:Locale = Locale.getCurrent(Application.application.systemManager);
            localeSelectorService.setLanguage(l.language);
        }
    ]]>
</mx:Script>
<mx:RemoteObject id="localeSelectorService" destination="localeSelector">
    <mx:method name="setLanguage" />
</mx:RemoteObject>