Object LocaleUtil
-
- All Implemented Interfaces:
@RestrictTo(value = {RestrictTo.Scope.LIBRARY_GROUP}) public class LocaleUtil
Utility class to use Locale.
-
-
Field Summary
Fields Modifier and Type Field Description public final static LocaleUtilINSTANCE
-
Method Summary
Modifier and Type Method Description final static StringtoLanguageTag(Locale locale)Gets the language tag from a Locale. final static LocalefromLanguageTag(String tag)Creates a Locale instance for a specific language tag. final static BooleanisValidLocale(Locale locale)Checks if a locale is valid. -
-
Method Detail
-
toLanguageTag
final static String toLanguageTag(Locale locale)
Gets the language tag from a Locale.
- Parameters:
locale- The locale.- Returns:
The tag of the locale, or null if not valid.
-
fromLanguageTag
final static Locale fromLanguageTag(String tag)
Creates a Locale instance for a specific language tag.
- Parameters:
tag- The tag of the language.- Returns:
The locale associated with that tag or null if tag in invalid.
-
isValidLocale
final static Boolean isValidLocale(Locale locale)
Checks if a locale is valid.
- Parameters:
locale- The locale.- Returns:
Whether locale is valid or not.
-
-
-
-