mobicontrol.intl.Locale(language, countryopt, variantopt)

This class represents a locale.

When used as a string in a script, will be converted to an underscore-concatenated string, consisting of language, country and variant. Language will always be lower case, and country will always be upper case. If the language is missing, the string will begin with an underscore. If both the language and country fields are missing, this function will return an empty string, even if the variant field is filled in. You can't have a locale with just a variant. The variant must accompany a valid language or country code.
For example: "en", "de_DE", "_GB", "en_US_WIN", "de__POSIX", "fr__MAC"

new Locale(language, countryopt, variantopt)

Construct an instance of the Locale class.
Parameters:
Name Type Attributes Description
language string ISO 639 alpha-2 or alpha-3 language code, or registered language subtags up to 8 alpha letters (for future enhancements). When a language has both an alpha-2 code and an alpha-3 code, the alpha-2 code must be used. You can find a full list of valid language codes in the IANA Language Subtag Registry (search for "Type: language"). The language field is case insensitive, but Locale always canonicalizes to lower case.
For example: "en" (English), "ja" (Japanese), "kok" (Konkani)

Alternatively, if country and variant are not provided, an underscore-concatenated string, consisting of language, country and variant.
For example: "en_CA" (Canadian English), "ja_JA" (Japanese)

country string <optional>
ISO 3166 alpha-2 country code or UN M.49 numeric-3 area code. You can find a full list of valid country and region codes in the IANA Language Subtag Registry (search for "Type: region"). The country (region) field is case insensitive, but Locale always canonicalizes to upper case.
For example: "US" (United States), "FR" (France), "029" (Caribbean)
variant string <optional>
Any arbitrary value used to indicate a variation of a Locale. Where there are two or more variant values each indicating its own semantics, these values should be ordered by importance, with most important first, separated by underscore('_'). The variant field is case sensitive.

For example: "polyton" (Polytonic Greek), "POSIX"

Since:
  • Version 1.1 (API level 2)
Example
var locale = new mobicontrol.intl.Locale("en", "CA");
try {
    mobicontrol.intl.setLocale(locale);
    mobicontrol.log.info('Locale set.');
} catch (err) {
    mobicontrol.log.error('Set locale failed with status code ' + err.statusCode);
}

Members

readonly country :string

Country code.

The country/region code of this locale; usually, either an empty string, an uppercase ISO 3166 2-letter code, or a UN M.49 3-digit code.

For example: "CA" (Canada), "JP" (Japan), "ES" (Spain)

Since:
  • Version 1.1 (API level 2)

readonly language :string

Language code.

The language code of this locale; usually, a lowercase ISO 639 alpha-2 or alpha-3 code.

For example: "en" (English), "ja" (Japanese), "kok" (Konkani)

Since:
  • Version 1.1 (API level 2)

readonly variant :string

Locale variant.

The variant code of this locale; usually, an empty string. A variant code is an arbitrary value used to indicate a variation of a locale.

For example: "polyton" (Polytonic Greek), "POSIX"

Since:
  • Version 1.1 (API level 2)