Top Description Constructors Methods
com.ibm.icu.impl

public Class LocaleUtility

extends Object
Class Inheritance
Imports
java.util.Locale

A class to hold utility functions missing from java.util.Locale.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Locale

Returns:

a new Locale that is a fallback from the given locale, or null.
fallback
(Locale loc)

Fallback from the given locale name by removing the rightmost _-delimited element.

public static Locale
getLocaleFromName(String name)

A helper function to convert a string of the form aa_BB_CC to a locale object.

public static boolean
isFallbackOf(String parent, String child)

Compare two locale strings of the form aa_BB_CC, and return true if parent is a 'strict' fallback of child, that is, if child =~ "^parent(_.+)*" (roughly).

public static boolean
isFallbackOf(Locale parent, Locale child)

Compare two locales, and return true if the parent is a 'strict' fallback of the child (parent string is a fallback of child string).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

LocaleUtilityback to summary
public LocaleUtility()

Method Detail

fallbackback to summary
public static Locale fallback(Locale loc)

Fallback from the given locale name by removing the rightmost _-delimited element. If there is none, return the root locale ("", "", ""). If this is the root locale, return null.

Note

The string "root" is not recognized; do not use it.

Returns:Locale

a new Locale that is a fallback from the given locale, or null.

getLocaleFromNameback to summary
public static Locale getLocaleFromName(String name)

A helper function to convert a string of the form aa_BB_CC to a locale object. Why isn't this in Locale?

isFallbackOfback to summary
public static boolean isFallbackOf(String parent, String child)

Compare two locale strings of the form aa_BB_CC, and return true if parent is a 'strict' fallback of child, that is, if child =~ "^parent(_.+)*" (roughly).

isFallbackOfback to summary
public static boolean isFallbackOf(Locale parent, Locale child)

Compare two locales, and return true if the parent is a 'strict' fallback of the child (parent string is a fallback of child string).