mx.resources

# Locale - AS3 Flex

Package | mx.resources
Class | public class Locale
Inheritance | Locale Object

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

The Locale class can be used to parse a locale String such as `"en_US_MAC"` into its three parts: a language code, a country code, and a variant.

The localization APIs in the IResourceManager and IResourceBundle interfaces use locale Strings rather than Locale instances, so this class is seldom used in an application.

Related API Elements

mx.resources.IResourceBundle
mx.resources.IResourceManager

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | country : String [read-only] The country code of this Locale instance. | Locale
|  | language : String [read-only] The language code of this Locale instance. | Locale
|  | variant : String [read-only] The variant part of this Locale instance. | Locale

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | Locale(localeString:String) Constructor. | Locale
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the locale String that was used to construct this Locale instance. | Locale
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Property Detail

### country

property

`country:String` [read-only]

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

The country code of this Locale instance. [Read-Only]

          var locale:Locale = new Locale("en_US_MAC");
          trace(locale.country); // outputs "US"

Implementation
`public function get country():String`

### language

property

`language:String` [read-only]

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

The language code of this Locale instance. [Read-Only]

          var locale:Locale = new Locale("en_US_MAC");
          trace(locale.language); // outputs "en"

Implementation
`public function get language():String`

### variant

property

`variant:String` [read-only]

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

The variant part of this Locale instance. [Read-Only]

          var locale:Locale = new Locale("en_US_MAC");
          trace(locale.variant); // outputs "MAC"

Implementation
`public function get variant():String`
Constructor Detail

### Locale

()
Constructor

`public function Locale(localeString:String)`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Constructor.

Parameters

| `localeString:String` — A 1-, 2-, or 3-part locale String, such as `"en"`, `"en_US"`, or `"en_US_MAC"`. The parts are separated by underscore characters. The first part is a two-letter lowercase language code as defined by ISO-639, such as `"en"` for English. The second part is a two-letter uppercase country code as defined by ISO-3166, such as `"US"` for the United States. The third part is a variant String, which can be used to optionally distinguish multiple locales for the same language and country. It is sometimes used to indicate the operating system that the locale should be used with, such as `"MAC"`, `"WIN"`, or `"UNIX"`.

Method Detail

### toString

()
method

`public function toString():String`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Returns the locale String that was used to construct this Locale instance. For example:

          var locale:Locale = new Locale("en_US_MAC");
          trace(locale.toString()); // outputs "en_US_MAC"

Returns

| `String` — Returns the locale String that was used to construct this Locale instance.

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00