Class

Xojo.Core.Locale


Warning

This item was deprecated in version 2020r2. Please use Locale as a replacement.

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

Text

Current

Locale

DecimalSeparator

Text

GroupingSeparator

Text

Identifier

Text

Raw

Locale

Methods

Name

Parameters

Returns

Shared

Constructor

localeIdentifier As String

Property descriptions


Xojo.Core.Locale.CurrencySymbol

CurrencySymbol As Text

The locale's currency symbol.

This property is read-only.

Get the locale's currency symbol:

Var locale As New Xojo.Core.Locale("en-US")

Var symbol As Text
symbol = locale.CurrencySymbol

Xojo.Core.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 property is read-only.

Get the current locale:

Var currentLocale As Xojo.Core.Locale
currentLocale = Xojo.Core.Locale.Current

Xojo.Core.Locale.DecimalSeparator

DecimalSeparator As Text

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 locale As New Xojo.Core.Locale("en-US")

Var decimal As Text
decimal = locale.DecimalSeparator

Xojo.Core.Locale.GroupingSeparator

GroupingSeparator As Text

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 locale As New Xojo.Core.Locale("en-US")

Var grouping As Text
grouping = locale.GroupingSeparator

Xojo.Core.Locale.Identifier

Identifier As Text

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 locale As New Xojo.Core.Locale("en-US")

Var id As Text
id = locale.Identifier

Xojo.Core.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 property is read-only.

Get the raw locale:

Var currentLocale As Xojo.Core.Locale
currentLocale = Xojo.Core.Locale.Raw

Method descriptions


Xojo.Core.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.

Creates a locale with the given localeIdentifier.

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

Warning

A RuntimeException will be raised if an invalid localeIdentifier is passed.

Links to look up codes: * The two-letter ISO 639-1 standard * ISO Online Browsing Platform * ISO Language Code Table * International Components for Unicode

Create an English US locale:

Var locale As New Xojo.Core.Locale("en-US")

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