The LocaleID class, available in
Flash Player 10.1, provides methods and properties for using locale
IDs. Locale IDs are strings that represent a particular locale.
They can be useful when deciding whether to change the layout direction of
an application.
The LocaleID class includes the isRightToLeft() method,
which returns true if the currently set locale
uses an RTL character code set, but otherwise returns false.
You can use this method to set the values of the layoutDirection and direction properties.
When you change locales in the following example, the application
checks the isRightToLeft() method and sets the layoutDirection and direction properties
on the Application object accordingly:
The executing SWF file for the previous example is shown below:
This example requires classes in the flash.globalization.* package,
which are available in the 10.1 or later playerglobal.swc file.
When compiling this example, be sure to set the target player version
to 10.1 or later. In Flash Builder, this option is on the Compiler
properties page. On the command-line, you can set the target Player
version by using the target-player option; for
example:
mxmlc -target-player=10.1 MyApp.mxml
In
your applications, you will typically have some additional logic
that sets the locale in your application, such as looking at the
OS language code or accepting a user-configured setting. For information
on setting locales in your application, see Setting the locale. For more information about using the classes
in the flash.globalization.* package, see Flash Player: Cultural diversity without complexity.