Class

# Locale

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Used to represent a <span class="title-ref">Locale</span>, which describes linguistic, cultural and other <span class="title-ref">Locale</span>-specific information. For example, a <span class="title-ref">Locale</span> might specify "English as spoken in the United States, using the metric system".

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                          | Type                                        | Read-Only | Shared |
|-----------------------------------------------|---------------------------------------------|-----------|--------|
| `CurrencySymbol<locale.currencysymbol>`       | `String</api/data_types/string>`            | ✓         |        |
| `DecimalSeparator<locale.decimalseparator>`   | `String</api/data_types/string>`            | ✓         |        |
| `GroupingSeparator<locale.groupingseparator>` | `String</api/data_types/string>`            | ✓         |        |
| `Handle<locale.handle>`                       | `Ptr</api/data_types/additional_types/ptr>` | ✓         |        |
| `Identifier<locale.identifier>`               | `String</api/data_types/string>`            | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                               | Parameters                                           | Returns | Shared |
|------------------------------------|------------------------------------------------------|---------|--------|
| `Constructor<locale.constructor0>` | localeIdentifier As `String</api/data_types/string>` |         |        |
| `Current<locale.current>`          |                                                      | Locale  | ✓      |
| `Raw<locale.raw>`                  |                                                      | Locale  | ✓      |

## Property descriptions

<div id="locale.currencysymbol">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Locale.CurrencySymbol

**CurrencySymbol** As `String</api/data_types/string>`

> The <span class="title-ref">Locale</span>'s currency symbol.
>
> This property is read-only.
>
> Get the <span class="title-ref">Locale</span>'s currency symbol:
>
> ``` xojo
> Var USEnglishLocale As New Locale("en-US")
>
> Var symbol As String
> symbol = USEnglishLocale.CurrencySymbol
> ```

<div id="locale.decimalseparator">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Locale.DecimalSeparator

**DecimalSeparator** As `String</api/data_types/string>`

> The <span class="title-ref">Locale</span>'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 <span class="title-ref">Locale</span>'s decimal separator:
>
> ``` xojo
> Var USEnglishLocale As New Locale("en-US")
>
> Var decimal As String
> decimal = USEnglishLocale.DecimalSeparator
> ```

<div id="locale.groupingseparator">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Locale.GroupingSeparator

**GroupingSeparator** As `String</api/data_types/string>`

> The <span class="title-ref">Locale</span>'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 <span class="title-ref">Locale</span>'s grouping separator:
>
> ``` xojo
> Var USEnglishlLocale As New Locale("en-US")
>
> Var grouping As String
> grouping = USEnglishlLocale.GroupingSeparator
> ```

<div id="locale.handle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Locale.Handle

**Handle** As `Ptr</api/data_types/additional_types/ptr>`

> A pointer to the object for use with `declares</api/language/declare>`.
>
> This property is read-only.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is currently only supported for Android.
>
> </div>

<div id="locale.identifier">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Locale.Identifier

**Identifier** As `String</api/data_types/string>`

> This is the <span class="title-ref">Locale</span>'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 <span class="title-ref">Locale</span>'s identifier:
>
> ``` xojo
> Var USEnglishLocale As New Locale("en-US")
>
> Var id As String
> id = USEnglishlLocale.Identifier
> ```

## Method descriptions

<div id="locale.constructor0">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Locale.Constructor

**Constructor**(localeIdentifier As `String</api/data_types/string>`)

> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> `Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above. The parameters are case sensitive. For example, "America/Chicago" is valid, while "america/chicago" is not. For best results, include both the region and language code, as the region code is required CurrencySymbol, DecimalSeparator, GroupingSeparator, and more.
>
> </div>
>
> Creates a <span class="title-ref">Locale</span> 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:
>
> - [ISO Language Code Table](http://www.lingoes.net/en/translator/langcode.htm)
> - [ISO Online Browsing Platform](https://www.iso.org/obp/ui/#search)
> - [International Components for Unicode](http://demo.icu-project.org/icu-bin/locexp)
> - The two-letter [ISO 639-1 standard](http://www.loc.gov/standards/iso639-2/php/English_list.php)
>
> An `InvalidArgumentException</api/exceptions/invalidargumentexception>` is raised when an invalid *localeIdentifier* is used.
>
> Create an English US \`Locale\`:
>
> ``` xojo
> Var USEnglishLocale As New Locale("en-US")
> ```

<div id="locale.current">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Locale.Current

**Current** As **Locale**

> The user's current <span class="title-ref">Locale</span>. This is established at application launch.
>
> For web apps, this is the <span class="title-ref">Locale</span> of the server. To get the <span class="title-ref">Locale</span> of the browser, use `WebSession.LanguageCode<websession.languagecode>`.
>
> This method is shared.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> This method does not support OS <span class="title-ref">locale</span> settings such as the user changing the separator characters.
>
> </div>
>
> Get the current \`Locale\`:
>
> ``` xojo
> Var currentLocale As Locale
> currentLocale = currentLocale.Current
> ```

<div id="locale.raw">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Locale.Raw

**Raw** As **Locale**

> A machine-independent <span class="title-ref">Locale</span> that has a well-defined format (i.e. the POSIX <span class="title-ref">Locale</span>) and is not affected by the user's settings.
>
> This method is shared.
>
> Get the raw \`Locale\`:
>
> ``` xojo
> Var currentLocale As Locale
> currentLocale = currentLocale.Raw
> ```

## Notes

For web apps, this returns the <span class="title-ref">Locale</span> of the app running on the server. To get the <span class="title-ref">Locale</span> of the connected user from the browser use `WebSession.LanguageCode<websession.languagecode>`.

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

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `DateTime</api/data_types/datetime>` class

</div>
