Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.

LocaleData

public final class LocaleData
extends Object

java.lang.Object
   ↳ android.icu.util.LocaleData


A class for accessing miscellaneous data in the locale bundles

Summary

Nested classes

class LocaleData.MeasurementSystem

Enumeration for representing the measurement systems. 

class LocaleData.PaperSize

A class that represents the size of letter head used in the country  

Constants

int ALT_QUOTATION_END

Delimiter type for getDelimiter(int).

int ALT_QUOTATION_START

Delimiter type for getDelimiter(int).

int QUOTATION_END

Delimiter type for getDelimiter(int).

int QUOTATION_START

Delimiter type for getDelimiter(int).

Public methods

static VersionInfo getCLDRVersion()

Returns the current CLDR version

String getDelimiter(int type)

Retrieves a delimiter string from the locale data.

static LocaleData getInstance(ULocale locale)

Gets the LocaleData object associated with the ULocale specified in locale

static LocaleData getInstance()

Gets the LocaleData object associated with the default FORMAT locale

static LocaleData.MeasurementSystem getMeasurementSystem(ULocale locale)

Returns the measurement system used in the locale specified by the locale.

boolean getNoSubstitute()

Gets the "no substitute" behavior of this locale data object.

static LocaleData.PaperSize getPaperSize(ULocale locale)

Returns the size of paper used in the locale.

void setNoSubstitute(boolean setting)

Sets the "no substitute" behavior of this locale data object.

Inherited methods

Constants

ALT_QUOTATION_END

added in API level 28
public static final int ALT_QUOTATION_END

Delimiter type for getDelimiter(int).

Constant Value: 3 (0x00000003)

ALT_QUOTATION_START

added in API level 28
public static final int ALT_QUOTATION_START

Delimiter type for getDelimiter(int).

Constant Value: 2 (0x00000002)

QUOTATION_END

added in API level 28
public static final int QUOTATION_END

Delimiter type for getDelimiter(int).

Constant Value: 1 (0x00000001)

QUOTATION_START

added in API level 28
public static final int QUOTATION_START

Delimiter type for getDelimiter(int).

Constant Value: 0 (0x00000000)

Public methods

getCLDRVersion

added in API level 28
public static VersionInfo getCLDRVersion ()

Returns the current CLDR version

Returns
VersionInfo

getDelimiter

added in API level 28
public String getDelimiter (int type)

Retrieves a delimiter string from the locale data.

Parameters
type int: The type of delimiter string desired. Currently, the valid choices are QUOTATION_START, QUOTATION_END, ALT_QUOTATION_START, or ALT_QUOTATION_END.

Returns
String The desired delimiter string.

getInstance

added in API level 28
public static LocaleData getInstance (ULocale locale)

Gets the LocaleData object associated with the ULocale specified in locale

Parameters
locale ULocale: Locale with thich the locale data object is associated.

Returns
LocaleData A locale data object.

getInstance

added in API level 28
public static LocaleData getInstance ()

Gets the LocaleData object associated with the default FORMAT locale

Returns
LocaleData A locale data object.

getMeasurementSystem

added in API level 28
public static LocaleData.MeasurementSystem getMeasurementSystem (ULocale locale)

Returns the measurement system used in the locale specified by the locale.

Parameters
locale ULocale: The locale for which the measurement system to be retrieved.

Returns
LocaleData.MeasurementSystem MeasurementSystem the measurement system used in the locale.

getNoSubstitute

added in API level 28
public boolean getNoSubstitute ()

Gets the "no substitute" behavior of this locale data object.

Returns
boolean Value for the no substitute behavior. If TRUE, methods of this locale data object will return an error when no data is available for that method, given the locale ID supplied to the constructor.

getPaperSize

added in API level 28
public static LocaleData.PaperSize getPaperSize (ULocale locale)

Returns the size of paper used in the locale. The paper sizes returned are always in milli-meters.

Parameters
locale ULocale: The locale for which the measurement system to be retrieved.

Returns
LocaleData.PaperSize The paper size used in the locale

setNoSubstitute

added in API level 28
public void setNoSubstitute (boolean setting)

Sets the "no substitute" behavior of this locale data object.

Parameters
setting boolean: Value for the no substitute behavior. If TRUE, methods of this locale data object will return an error when no data is available for that method, given the locale ID supplied to the constructor.