13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Internationalizing applications<br />

Locale A value that repres<strong>en</strong>ts the language and cultural conv<strong>en</strong>tions used in a geographical, political, or cultural<br />

region (which in many cases indicates a single country). A unique locale id<strong>en</strong>tifier (locale ID) repres<strong>en</strong>ts this value.<br />

The locale ID is used to look up a set of locale data that provides locale-specific support. This support applies to<br />

measurem<strong>en</strong>t units, the parsing and formatting of numbers and dates, and so on.<br />

Resource Bundle A stored set of locale-specific elem<strong>en</strong>ts that are created for a locale in which an application is used.<br />

A resource bundle typically contains all text elem<strong>en</strong>ts in the application’s user interface. Within the bundle, these<br />

elem<strong>en</strong>ts are translated into the appropriate language for the giv<strong>en</strong> locale. It can also contain other settings that alter<br />

the layout or behavior of the user interface for a specific locale. A resource bundle can contain other media types, or<br />

refer<strong>en</strong>ces to other media types, that are locale-specific.<br />

Overview of the flash.globalization package<br />

Flash Player 10.1 and later, Adobe AIR 2.0 and later<br />

The flash.globalization package harnesses the cultural support capabilities of the underlying operating system. It<br />

makes it easier to write applications that follow the cultural conv<strong>en</strong>tions of individual users.<br />

The main classes in the package include:<br />

The Collator class which governs the sorting and matching of strings<br />

The Curr<strong>en</strong>cyFormatter class which formats numbers into curr<strong>en</strong>cy amount strings, and parses curr<strong>en</strong>cy amounts<br />

and symbols from input strings<br />

The DateTimeFormatter class which formats date values<br />

The LocaleID class for retrieving information about a specific locale<br />

The NumberFormatter class which formats and parses numeric values<br />

The StringTools class which handles locale-s<strong>en</strong>sitive case conversion of strings<br />

The flash.globalization package and resource localization<br />

The flash.globalization package doesn’t handle resource localization. However you can use the flash.globalization<br />

locale ID as the key value for retrieving localized resources using other techniques. For example, you can localize<br />

application resources built with Flex using the ResourceManager and ResourceBundle classes. For more information,<br />

see Localizing Flex Applications.<br />

Adobe AIR 1.1 also contains some features to help localize AIR applications, as discussed in “Localizing AIR<br />

applications” on page 957.<br />

A g<strong>en</strong>eral approach to internationalizing an application<br />

The following steps describe a high-level common approach for internationalizing an application using the<br />

flash.globalization package:<br />

1 Determine or set the locale.<br />

2 Create an instance of a service class (Collator, Curr<strong>en</strong>cyFormatter, DateTimeFormatter, NumberFormatter, or<br />

StringTools).<br />

3 Check for errors and fallbacks using lastOperationStatus properties.<br />

4 Format and display information using locale-specific settings.<br />

Last updated 6/6/2012<br />

940

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!