public class LocaleUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String[] |
COUNTRY_CODES
Array with all country codes.
|
static String[] |
LANGUAGE_CODES
The Constant LANGUAGE_CODES.
|
| Constructor and Description |
|---|
LocaleUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Locale |
getLocale(String code)
Converts the given
String code like "en", "en_US" or "en_US_win" to new
Locale. |
static String |
getLocaleCode(File propertiesFile)
Gets from the given properties file the locale code like "en", "en_US" or "en_US_win".
|
static String |
getLocaleFilenameSuffix(Locale locale)
Gets the locale file name suffix that has the format 'language_COUNTRY_variant' for instance
'de_DE' for the Locale.GERMANY.
|
static String |
getLocaleFileSuffix(Locale locale,
boolean withCountry)
Gets the locale file name suffix for instance '_de_DE' for the Locale.GERMANY.
|
static String |
getLocaleFileSuffix(Locale locale,
boolean withCountry,
boolean withVariant)
Gets the locale file name suffix for instance '_de_DE' for the Locale.GERMANY.
|
static String |
getLocaleFileSuffix(Locale locale,
boolean withCountry,
boolean withVariant,
boolean withUnderscorePrefix)
Gets the locale file name suffix for instance '_de_DE' for the Locale.GERMANY.
|
static String |
getLocaleName(Locale locale)
Deprecated.
use instead
getLocaleFilenameSuffix(Locale) |
static boolean |
isISOCountryCode(String code)
Checks the given code if its a valide ISO 3166-1 countrycode.
|
public static final String[] COUNTRY_CODES
public static final String[] LANGUAGE_CODES
public static Locale getLocale(String code)
String code like "en", "en_US" or "en_US_win" to new
Locale.code - the codeLocale object or null.public static String getLocaleCode(File propertiesFile)
propertiesFile - the properties filepublic static String getLocaleFilenameSuffix(Locale locale)
locale - the localepublic static String getLocaleFileSuffix(Locale locale, boolean withCountry)
locale - the localewithCountry - the with countrypublic static String getLocaleFileSuffix(Locale locale, boolean withCountry, boolean withVariant)
locale - the localewithCountry - with countrywithVariant - with variantpublic static String getLocaleFileSuffix(Locale locale, boolean withCountry, boolean withVariant, boolean withUnderscorePrefix)
locale - the localewithCountry - with countrywithVariant - with variantwithUnderscorePrefix - true if the result has to have the underscore prefix@Deprecated public static String getLocaleName(Locale locale)
getLocaleFilenameSuffix(Locale)locale - the localepublic static boolean isISOCountryCode(String code)
code - The code to check.Copyright © 2007–2015 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.