Class LocaleData


  • public final class LocaleData
    extends java.lang.Object
    A class for accessing miscellaneous data in the locale bundles
    • Constructor Detail

      • LocaleData

        private LocaleData()
    • Method Detail

      • getExemplarSet

        public static UnicodeSet getExemplarSet​(ULocale locale,
                                                int options)
        Returns the set of exemplar characters for a locale. Equivalent to calling getExemplarSet(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. See UnicodeSet.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. See UnicodeSet.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. See UnicodeSet.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 default FORMAT 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.
      • measurementTypeBundleForLocale

        private static UResourceBundle measurementTypeBundleForLocale​(ULocale locale,
                                                                      java.lang.String measurementType)
        Utility for getMeasurementSystem and getPaperSize
      • 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