Skip to content
Titanium SDK
Version13.4.1

Global.Intl

moduleAndroidiPhoneiPadmacOSsince iPhone 6.0.0, iPad 6.0.0, Android 9.1.0, macOS 9.2.0

Namespace providing JavaScript's standard internationalization APIs.

Provides support for localized number formatting, date/time formatting, and language sensitive string comparisons.

For more detail, see the MDN website about Intl.

Methods 1

Gets canonical locale identifiers matching given BCP 47 locale identifiers.

// Will return ['en-US'].
Ti.API.info(Intl.getCanonicalLocales('EN-US'));

// Will return ['en-US', 'fr'].
Ti.API.info(Intl.getCanonicalLocales(['EN-US', 'Fr']));
Parameters
ParametersTypeDescription
locales?String | Array<String>

A string or array of strings providing BCP 47 locale identifiers to fetch the canonical names of.

Returns Array<String>

Returns an array of canonical names matching given BCP 47 locale names. Duplicate locales will be removed. Returns an empty array if argument is empty or undefined.