Class

Locale


Description

Used to represent a Locale, which describes linguistic, cultural and other Locale-specific information. For example, a Locale might specify "English as spoken in the United States, using the metric system".

Properties

Name

Type

Read-Only

Shared

CurrencySymbol

String

DecimalSeparator

String

GroupingSeparator

String

Handle

Ptr

Identifier

String

Methods

Name

Parameters

Returns

Shared

Constructor

localeIdentifier As String

Current

Locale

Raw

Locale

Property descriptions


Locale.CurrencySymbol

CurrencySymbol As String

The Locale's currency symbol.

This property is read-only.

Get the Locale's currency symbol:

Var USEnglishLocale As New Locale("en-US")

Var symbol As String
symbol = USEnglishLocale.CurrencySymbol

Locale.DecimalSeparator

DecimalSeparator As String

The Locale's separator between the integer and decimal portions of a number. In "un-US", this is the 'period'.

This property is read-only.

Get the Locale's decimal separator:

Var USEnglishLocale As New Locale("en-US")

Var decimal As String
decimal = USEnglishLocale.DecimalSeparator

Locale.GroupingSeparator

GroupingSeparator As String

The Locale's separator for grouping a number. In "en-US", this is the 'comma' placed between every three integer digits.

This property is read-only.

Get the Locale's grouping separator:

Var USEnglishlLocale As New Locale("en-US")

Var grouping As String
grouping = USEnglishlLocale.GroupingSeparator

Locale.Handle

Handle As Ptr

A pointer to the object for use with declares.

This property is read-only.

Important

This property is currently only supported for Android.


Locale.Identifier

Identifier As String

This is the Locale's identifier. The identifier may not exactly match the identifier passed in via the constructor due to conversions (e.g. 'en_US' could become 'en-US').

This property is read-only.

Get the Locale's identifier:

Var USEnglishLocale As New Locale("en-US")

Var id As String
id = USEnglishlLocale.Identifier

Method descriptions


Locale.Constructor

Constructor(localeIdentifier As String)

Note

Constructors are special methods called when you create an object with the New keyword and pass in the parameters above. The parameters are case sensitive. For example, "America/Chicago" is valid, while "america/chicago" is not.

Creates a Locale with the given localeIdentifier.

As an example, "en-US" is used as a localeIdentifier for English in the United States.

Links to look up codes:

A RuntimeException is raised when an invalid localeIdentifier is used.

Create an English US Locale:

Var USEnglishLocale As New Locale("en-US")

Locale.Current

Current As Locale

The user's current Locale. For web apps, this is the Locale of the server. To get the Locale of the browser, use WebSession.

This method is shared.

Get the current Locale:

Var currentLocale As Locale
currentLocale = currentLocale.Current

Note

This method does not support OS locale settings such as the user changing the separator characters.


Locale.Raw

Raw As Locale

A machine-independent Locale that has a well-defined format (i.e. the POSIX Locale) and is not affected by the user's settings.

This method is shared.

Get the raw Locale:

Var currentLocale As Locale
currentLocale = currentLocale.Raw

Notes

For web apps, this returns the Locale of the app running on the server. To get the Locale of the connected user from the browser use WebSession.

For more information on localization, refer to the Localization topic .

Compatibility

All project types on all supported operating systems.

See also

Object parent class; DateTime class