|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.github.fge.msgsimple.locale.LocaleUtils
public final class LocaleUtils
Utility methods for Locale management
This class provides two methods:
parseLocale(String) parses a string and builds a Locale object (strangely enough, there is no such method in the JDK!);
getApplicable(Locale) returns an ordered list of locales
"applicable" to the given locale.The getApplicable(Locale) method emulates what the JDK's ResourceBundle does when you look up a message in a locale; it returns an
ordered list from the most specific to the more general. For instance, given
the locale "ja_JP_JP", it will generate the following list:
"ja_JP_JP","ja_JP","ja","" (the root locale, Locale.ROOT).
| Method Summary | |
|---|---|
static Collection<Locale> |
getApplicable(Locale target)
Get a "decrementing" list of candidate locales for a given locale |
static Locale |
parseLocale(String input)
Parse a string input as an argument and return a locale object |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Locale parseLocale(String input)
Three things to note:
Locale.ROOT is returned.
input - the input string
Locale
NullPointerException - input is null
IllegalArgumentException - input is malformed (see above)Localepublic static Collection<Locale> getApplicable(Locale target)
The order of locale returned is from the more specific to the less
specific (the latter being Locale.ROOT).
target - the locale
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||