Package com.ibm.icu.util
Class LocaleData
- java.lang.Object
-
- com.ibm.icu.util.LocaleData
-
public final class LocaleData extends java.lang.Object
A class for accessing miscellaneous data in the locale bundles- Author:
- ram
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LocaleData.MeasurementSystem
Enumeration for representing the measurement systems.static class
LocaleData.PaperSize
A class that represents the size of letter head used in the country
-
Field Summary
Fields Modifier and Type Field Description static int
ALT_QUOTATION_END
Delimiter type forgetDelimiter(int)
.static int
ALT_QUOTATION_START
Delimiter type forgetDelimiter(int)
.static int
DELIMITER_COUNT
Deprecated.ICU 58 The numeric value may change over time, see ICU ticket #12420.static int
ES_AUXILIARY
EXType forgetExemplarSet(int, int)
.static int
ES_COUNT
Deprecated.ICU 58 The numeric value may change over time, see ICU ticket #12420.static int
ES_CURRENCY
Deprecated.ICU 51static int
ES_INDEX
EXType forgetExemplarSet(int, int)
.static int
ES_PUNCTUATION
Corresponds to the 'punctuation' CLDR exemplars in http://www.unicode.org/reports/tr35/tr35-general.html#Character_Elements.static int
ES_STANDARD
EXType forgetExemplarSet(int, int)
.static int
QUOTATION_END
Delimiter type forgetDelimiter(int)
.static int
QUOTATION_START
Delimiter type forgetDelimiter(int)
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static VersionInfo
getCLDRVersion()
Returns the current CLDR versionjava.lang.String
getDelimiter(int type)
Retrieves a delimiter string from the locale data.UnicodeSet
getExemplarSet(int options, int extype)
Returns the set of exemplar characters for a locale.static UnicodeSet
getExemplarSet(ULocale locale, int options)
Returns the set of exemplar characters for a locale.static UnicodeSet
getExemplarSet(ULocale locale, int options, int extype)
Returns the set of exemplar characters for a locale.static LocaleData
getInstance()
Gets the LocaleData object associated with the defaultFORMAT
localestatic LocaleData
getInstance(ULocale locale)
Gets the LocaleData object associated with the ULocale specified in localejava.lang.String
getLocaleDisplayPattern()
Returns LocaleDisplayPattern for this locale, e.g., {0}({1})java.lang.String
getLocaleSeparator()
Returns LocaleDisplaySeparator for this 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.
-
-
-
Field Detail
-
ES_STANDARD
public static final int ES_STANDARD
EXType forgetExemplarSet(int, int)
. Corresponds to the 'main' (aka 'standard') CLDR exemplars in http://www.unicode.org/reports/tr35/tr35-general.html#Character_Elements.- See Also:
- Constant Field Values
-
ES_AUXILIARY
public static final int ES_AUXILIARY
EXType forgetExemplarSet(int, int)
. Corresponds to the 'auxiliary' CLDR exemplars in http://www.unicode.org/reports/tr35/tr35-general.html#Character_Elements.- See Also:
- Constant Field Values
-
ES_INDEX
public static final int ES_INDEX
EXType forgetExemplarSet(int, int)
. Corresponds to the 'index' CLDR exemplars in http://www.unicode.org/reports/tr35/tr35-general.html#Character_Elements.- See Also:
- Constant Field Values
-
ES_CURRENCY
@Deprecated public static final int ES_CURRENCY
Deprecated.ICU 51EXType forgetExemplarSet(int, int)
. Corresponds to the 'currencySymbol' CLDR exemplars in http://www.unicode.org/reports/tr35/tr35-general.html#Character_Elements. Note: This type is no longer supported.- See Also:
- Constant Field Values
-
ES_PUNCTUATION
public static final int ES_PUNCTUATION
Corresponds to the 'punctuation' CLDR exemplars in http://www.unicode.org/reports/tr35/tr35-general.html#Character_Elements. EXType forgetExemplarSet(int, int)
.- See Also:
- Constant Field Values
-
ES_COUNT
@Deprecated public static final int ES_COUNT
Deprecated.ICU 58 The numeric value may change over time, see ICU ticket #12420.Count of EXTypes forgetExemplarSet(int, int)
.- See Also:
- Constant Field Values
-
QUOTATION_START
public static final int QUOTATION_START
Delimiter type forgetDelimiter(int)
.- See Also:
- Constant Field Values
-
QUOTATION_END
public static final int QUOTATION_END
Delimiter type forgetDelimiter(int)
.- See Also:
- Constant Field Values
-
ALT_QUOTATION_START
public static final int ALT_QUOTATION_START
Delimiter type forgetDelimiter(int)
.- See Also:
- Constant Field Values
-
ALT_QUOTATION_END
public static final int ALT_QUOTATION_END
Delimiter type forgetDelimiter(int)
.- See Also:
- Constant Field Values
-
DELIMITER_COUNT
@Deprecated public static final int DELIMITER_COUNT
Deprecated.ICU 58 The numeric value may change over time, see ICU ticket #12420.Count of delimiter types forgetDelimiter(int)
.- See Also:
- Constant Field Values
-
-
Method Detail
-
getExemplarSet
public static UnicodeSet getExemplarSet(ULocale locale, int options)
Returns the set of exemplar characters for a locale. Equivalent to callinggetExemplarSet(ULocale, int, int)
with the extype ==ES_STANDARD
.- Parameters:
locale
- Locale for which the exemplar character set is to be retrieved.options
- Bitmask for options to apply to the exemplar pattern. Specify zero to retrieve the exemplar set as it is defined in the locale data. Specify UnicodeSet.CASE to retrieve a case-folded exemplar set. SeeUnicodeSet.applyPattern(String, int)
for a complete list of valid options. The IGNORE_SPACE bit is always set, regardless of the value of 'options'.- Returns:
- The set of exemplar characters for the given locale.
-
getExemplarSet
public static UnicodeSet getExemplarSet(ULocale locale, int options, int extype)
Returns the set of exemplar characters for a locale. Equivalent to calling new LocaleData(locale).getExemplarSet(int, int)
.- Parameters:
locale
- Locale for which the exemplar character set is to be retrieved.options
- Bitmask for options to apply to the exemplar pattern. Specify zero to retrieve the exemplar set as it is defined in the locale data. Specify UnicodeSet.CASE to retrieve a case-folded exemplar set. SeeUnicodeSet.applyPattern(String, int)
for a complete list of valid options. The IGNORE_SPACE bit is always set, regardless of the value of 'options'.extype
- The type of exemplar character set to retrieve.- Returns:
- The set of exemplar characters for the given locale.
-
getExemplarSet
public UnicodeSet getExemplarSet(int options, int extype)
Returns the set of exemplar characters for a locale.- Parameters:
options
- Bitmask for options to apply to the exemplar pattern. Specify zero to retrieve the exemplar set as it is defined in the locale data. Specify UnicodeSet.CASE to retrieve a case-folded exemplar set. SeeUnicodeSet.applyPattern(String, int)
for a complete list of valid options. The IGNORE_SPACE bit is always set, regardless of the value of 'options'.extype
- The type of exemplar set to be retrieved, ES_STANDARD, ES_INDEX, ES_AUXILIARY, or ES_PUNCTUATION- Returns:
- The set of exemplar characters for the given locale.
If there is nothing available for the locale,
then null is returned if
getNoSubstitute()
is true, otherwise the root value is returned (which may be UnicodeSet.EMPTY). - Throws:
java.lang.RuntimeException
- if the extype is invalid.
-
getInstance
public static final LocaleData getInstance(ULocale locale)
Gets the LocaleData object associated with the ULocale specified in locale- Parameters:
locale
- Locale with thich the locale data object is associated.- Returns:
- A locale data object.
-
getInstance
public static final LocaleData getInstance()
Gets the LocaleData object associated with the defaultFORMAT
locale- Returns:
- A locale data object.
- See Also:
ULocale.Category.FORMAT
-
setNoSubstitute
public void setNoSubstitute(boolean setting)
Sets the "no substitute" behavior of this locale data object.- Parameters:
setting
- 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.
-
getNoSubstitute
public boolean getNoSubstitute()
Gets the "no substitute" behavior of this locale data object.- Returns:
- 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.
-
getDelimiter
public java.lang.String getDelimiter(int type)
Retrieves a delimiter string from the locale data.- Parameters:
type
- The type of delimiter string desired. Currently, the valid choices are QUOTATION_START, QUOTATION_END, ALT_QUOTATION_START, or ALT_QUOTATION_END.- Returns:
- The desired delimiter string.
-
getMeasurementSystem
public static final LocaleData.MeasurementSystem getMeasurementSystem(ULocale locale)
Returns the measurement system used in the locale specified by the locale.- Parameters:
locale
- The locale for which the measurement system to be retrieved.- Returns:
- MeasurementSystem the measurement system used in the locale.
-
getPaperSize
public static final 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
- The locale for which the measurement system to be retrieved.- Returns:
- The paper size used in the locale
-
getLocaleDisplayPattern
public java.lang.String getLocaleDisplayPattern()
Returns LocaleDisplayPattern for this locale, e.g., {0}({1})- Returns:
- locale display pattern as a String.
-
getLocaleSeparator
public java.lang.String getLocaleSeparator()
Returns LocaleDisplaySeparator for this locale.- Returns:
- locale display separator as a char.
-
getCLDRVersion
public static VersionInfo getCLDRVersion()
Returns the current CLDR version
-
-