qnx.locale.Locale

Locale

Properties | Methods | Events


Packageqnx.locale
Classpublic class Locale
InheritanceLocale Inheritance flash.events.EventDispatcher

The Locale class represents a specific locale. Each country or region uses a unique locale code and a locale-specific resource file structure to define language, symbols, or images that are specific to that region or country.

You can use the Locale class to change or access locale-specific items such as language resource strings or images. To change the locale of the entire application, you must use the LocaleManager class.



Class information:
BlackBerry 10 Version:   10.0.0

See also

LocaleManager
LocaleResourceBundle



Public Properties

 PropertyDefined By
  country : String
[read-only] The country of the locale.
Locale
  id : String
[read-only] Gets the ID of the locale.
Locale
  language : String
[read-only] The language of the locale.
Locale
  resources : LocaleResourceBundle
Returns the LocaleResourceBundle used by this locale.
Locale

Public Methods

 MethodDefined By
  
Locale(locale_id:String, loadResource:Boolean = false)
Creates a new Locale instance given an ID.
Locale
  
cancel():void
Cancels the load of a resource property file for the current locale.
Locale
  
formatCurrency(currency:Number, withCurrencySymbol:Boolean):String
Returns a String in the format of the current locale currency.
Locale
  
formatDate(date:Date, dateStyle:String, timeStyle:String):String
Returns a formatted Date String based on the locale.
Locale
  
formatNumber(num:Number):String
Returns a String in the format of the current locale.
Locale
  
getDateOrder():Vector.<String>
Returns the day, month, year order based on locale.
Locale
  
getResource(key:String, ... args):String
Returns the resource for the specified key from the currently loaded localization file.
Locale
  
isTime24Hr():Boolean
Returns whether the clock format should be displayed as 24hr format
Locale
  
Loads the resource property file for the current locale.
Locale
  
merge(locale:Locale):void
Merges the resources of the supplied locale with the resources from the target locale.
Locale

Events

 Event Summary Defined By
  Dispatched after a property file has been successfully loaded and parsed.Locale

Property Detail

country


country:String  [read-only]

The country of the locale. The last two letters of the locale id. For example the locale en_US would have a country code of US.


Implementation

public function get country():String

id


id:String  [read-only]

Gets the ID of the locale.


Implementation

public function get id():String

language


language:String  [read-only]

The language of the locale. The first two letters of the locale id. For example the locale en_US would have a country code of en.


Implementation

public function get language():String

resources


resources:LocaleResourceBundle

Returns the LocaleResourceBundle used by this locale.


Implementation

public function get resources():LocaleResourceBundle
public function set resources(value:LocaleResourceBundle):void

Constructor Detail

Locale()


public function Locale(locale_id:String, loadResource:Boolean = false)

Creates a new Locale instance given an ID.

Parameters

locale_id:String — A String representing the ID of the locale. For example, en_US.
loadResource:Boolean (default = false) — An optional parameter that, when set to true, loads the resource.property file for the locale upon creation. The default value is false.

See also

loadResources()

Method Detail

cancel()


public function cancel():void

Cancels the load of a resource property file for the current locale.

formatCurrency()


public function formatCurrency(currency:Number, withCurrencySymbol:Boolean):String

Returns a String in the format of the current locale currency.

Parameters

currency:Number — The current currency value to be formatted.
withCurrencySymbol:Boolean — A Boolean that determines if the currency symbol will be returned in the String.

Returns

String — The formatted String.

formatDate()


public function formatDate(date:Date, dateStyle:String, timeStyle:String):String

Returns a formatted Date String based on the locale.

Parameters

date:Date — The date to be formatted.
dateStyle:String (default = NaN) — The date style to use when formatting the date. See the DateTimeStyle class for valid values. The default is DateTimeStyle.NONE.
timeStyle:String (default = NaN) — The time style to use when formatting the time. See the DateTimeStyle class for valid values. The default is DateTimeStyle.NONE.

Returns

String — A String representing the formatted date.

See also

DateTimeStyle

formatNumber()


public function formatNumber(num:Number):String

Returns a String in the format of the current locale.

Parameters

num:Number — The Number to be formatted.

Returns

String — The formatted String.

getDateOrder()


public function getDateOrder():Vector.<String>

Returns the day, month, year order based on locale.

Returns

Vector.<String> — A String Vector with values of LocalDateTime.DAY, LocalDateTime.MONTH, LocaleDateTime.YEAR, in the order which they should be displayed.

getResource()


public function getResource(key:String, ... args):String

Returns the resource for the specified key from the currently loaded localization file.

Parameters

key:String — The key of the resource that is returned.
... args — Optional parameters that can be used as wildcard replacements in the returned String.

Returns

String — A String representing the value of the key in the localization file.

isTime24Hr()


public function isTime24Hr():Boolean

Returns whether the clock format should be displayed as 24hr format

Returns

Boolean

loadResources()


public function loadResources():void

Loads the resource property file for the current locale. This method attempts to load a file in the following path locale/<locale id>/resource.properties, where <locale id> is the current locale ID.

merge()


public function merge(locale:Locale):void

Merges the resources of the supplied locale with the resources from the target locale. If there are duplicate keys, resources from the original are not replaced.

Parameters

locale:Locale — A locale object to merge with this one.

Event Detail

complete


Event Object Type: flash.events.Event
Event.type property = flash.events.Event.COMPLETE

Dispatched after a property file has been successfully loaded and parsed.





comments powered by Disqus