|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.util.I18n
public final class I18n
some utility methods useful for internationalization.
Country| Method Summary | |
|---|---|
static Locale |
findCountryMatch(Locale locale,
Collection<Locale> candidates)
tries to find a matching Locale within the given collection with respect to the country. |
static Locale |
findLanguageMatch(Locale locale,
Collection<Locale> candidates)
tries to find a matching Locale within the given collection with respect to the language. |
static String |
getCountryCodeForName(String countryName)
|
static String |
getCountryCodeForName(String countryName,
Locale l)
returns the corresponding 2-letter code if the country is found or null |
static ImageIcon |
getCountryIcon(String countryCode)
returns a 16 x 11 pixel icon for the given country code or null if no icon is available |
static ResourceBundle |
getCountryLanguage()
|
static ResourceBundle |
getCountryLanguage(Locale l)
maps the 2-letter country code to the display name |
static String |
getCountryLanguageBundleName()
|
static String |
getCountryName(String countryCode)
|
static String |
getCountryName(String countryCode,
Locale l)
returns the display name of any ISO 3166 2-letter country code in the given language |
static ArrayList<String> |
getCountryNames()
|
static ArrayList<String> |
getCountryNames(Locale l)
returns all existing ISO country names that can be mapped to a code in a newly created and sorted list |
static HashSet<Currency> |
getCurrencies()
|
static String |
getDefaultCountryName()
|
static String[] |
getEUCountryCodes()
|
static String[] |
getEUCountryCodes(boolean reRead)
the return value can be altered by setting the property 'eu.countries' in the Settings to a comma/semicolon/space/tab separated list of country codes |
static String |
getLanguageCodeForName(String name)
returns the corresponding ISO 639 language code for the given name based on the default Locale |
static String |
getLanguageCodeForName(String str,
Locale l)
returns the corresponding ISO 639 language code for the given name based on the given Locale |
static JComboBox |
getLanguageComboBox(boolean useFullName)
|
static JComboBox |
getLanguageComboBox(boolean useFullName,
Locale l)
provides a component for selecting languages based on either ISO 639 code or the full name |
static JComboBox |
getLanguageComboBox(String[] lang,
Locale displayLang)
provides a component for selecting languages based on the given array |
static String[] |
getLanguageNames()
returns an (unsorted) array of localized names for all ISO 639 languages based on the default Locale |
static String[] |
getLanguageNames(Locale l)
returns an (unsorted) array of localized names for all ISO 639 languages based on the given Locale |
static FormattedCellRenderer |
getLanguageRenderer()
|
static FormattedCellRenderer |
getLanguageRenderer(Locale l)
|
static Object |
getLocalized(Map<?,?> properties,
String keyBase,
Locale locale)
uses a default ResourceBundle.Control to fulfill the request |
static Object |
getLocalized(Map<?,?> properties,
String keyBase,
Locale locale,
ResourceBundle.Control control)
searches the properties for a suitable localized key and returns its value. |
static ArrayList<String> |
getSupportedCountryNames()
|
static ArrayList<String> |
getSupportedCountryNames(Locale language)
returns a sorted list of all supported country names in the given language. |
static boolean |
isEUCountry(String countryCode)
returns true only if the given ISO 3166 country code belongs to a country within the European Union |
static boolean |
isISOCountry(String countryCode)
based on uppercase ISO 3166 2-letter code (comparison is case-insensitive, though) |
static boolean |
isSupportedCountry(String countryCode)
returns true only if there is a Locale available for that country code |
static boolean |
isUseBundle()
|
static Locale |
localeFor(String localeIdentifier)
retrieves the Locale based on the toString() method of a supported Locale, or null if none is available. |
static Locale |
localeForCountry(String countryCode)
retrieves an existing predefined Locale based on a given uppercase ISO 3166 2-letter code or null if none is available (note that not all supported countries have an associated Locale). |
static Locale |
localeForCountryName(String countryName)
|
static Locale |
localeForCountryName(String countryName,
Locale locale)
|
static String |
sampleString(Locale l)
returns a sample String for the given locale - displayed in the default locale |
static String |
sampleString(Locale locale,
Locale language)
returns a sample String for the given locale displayed in the given language |
static void |
setCountryLanguageBundleName(String bundleName)
|
static void |
setUseBundle(boolean flag)
if true, a custom resource bundle is used to determine country names |
static Locale |
toLocale(String str)
returns a Locale by parsing the given string assuming that the string is derived from the toString() method of some Locale. |
static Properties |
toProperties(ResourceBundle bundle)
|
static ResourceBundle |
toResourceBundle(Map<?,?> data)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static String getCountryLanguageBundleName()
public static void setCountryLanguageBundleName(String bundleName)
public static boolean isUseBundle()
public static void setUseBundle(boolean flag)
getCountryName(String, Locale),
setCountryLanguageBundleName(String)
public static Object getLocalized(Map<?,?> properties,
String keyBase,
Locale locale)
public static Object getLocalized(Map<?,?> properties,
String keyBase,
Locale locale,
ResourceBundle.Control control)
public static String sampleString(Locale l)
public static String sampleString(Locale locale,
Locale language)
public static ResourceBundle getCountryLanguage()
public static ResourceBundle getCountryLanguage(Locale l)
public static String getCountryName(String countryCode)
throws NullPointerException,
MissingResourceException
NullPointerException
MissingResourceException
public static String getCountryName(String countryCode,
Locale l)
throws NullPointerException,
MissingResourceException
NullPointerException
MissingResourceExceptionpublic static String getCountryCodeForName(String countryName)
public static String getCountryCodeForName(String countryName,
Locale l)
public static String getDefaultCountryName()
public static ArrayList<String> getCountryNames()
public static ArrayList<String> getCountryNames(Locale l)
public static Locale toLocale(String str)
throws IllegalArgumentException
IllegalArgumentExceptionpublic static Locale localeFor(String localeIdentifier)
public static Locale localeForCountryName(String countryName)
public static Locale localeForCountryName(String countryName,
Locale locale)
public static ArrayList<String> getSupportedCountryNames()
getSupportedCountryNames(Locale)public static ArrayList<String> getSupportedCountryNames(Locale language)
public static Locale localeForCountry(String countryCode)
public static boolean isSupportedCountry(String countryCode)
public static String[] getEUCountryCodes()
public static String[] getEUCountryCodes(boolean reRead)
Settings.setProperty(String, String)public static boolean isISOCountry(String countryCode)
public static boolean isEUCountry(String countryCode)
public static HashSet<Currency> getCurrencies()
public static JComboBox getLanguageComboBox(boolean useFullName)
getLanguageComboBox(boolean, Locale)
public static JComboBox getLanguageComboBox(boolean useFullName,
Locale l)
useFullName - if true, the full language name is used as a selectable value instead of the ISO 639 codel - the language used for the display of the languagegetLanguageCodeForName(String, Locale)
public static JComboBox getLanguageComboBox(String[] lang,
Locale displayLang)
lang - an array of either ISO 639 codes or language names based on the given LocaledisplayLang - the language used for the display of the languagegetLanguageCodeForName(String, Locale)public static FormattedCellRenderer getLanguageRenderer()
public static FormattedCellRenderer getLanguageRenderer(Locale l)
public static String[] getLanguageNames()
public static String[] getLanguageNames(Locale l)
public static String getLanguageCodeForName(String name)
public static String getLanguageCodeForName(String str,
Locale l)
public static ImageIcon getCountryIcon(String countryCode)
public static Locale findLanguageMatch(Locale locale,
Collection<Locale> candidates)
public static Locale findCountryMatch(Locale locale,
Collection<Locale> candidates)
public static ResourceBundle toResourceBundle(Map<?,?> data)
public static Properties toProperties(ResourceBundle bundle)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||