public class I18n extends Object
Constructor and Description |
---|
I18n(ResourceBundle guiBundle,
ResourceBundle languageBundle) |
Modifier and Type | Method and Description |
---|---|
static void |
addOnLanguageChangedListener(LanguageChangedListener listener) |
Locale |
getCurrentLocale() |
static String |
getCurrentLocaleID() |
String |
getFormattedString(String stringId,
String defaultValue,
Object... args)
Retrieves a resource string using the current locale.
|
String |
getGUIReference(String reference) |
static List<Locale> |
getListOfAvailableLanguages(Class cl) |
static Set<String> |
getResourcesInPackage(Class coreClass,
String packageName)
Enumerates the resouces in a give package name.
|
String |
getString(String stringId)
Retreives a resource string using the current locale.
|
String |
getString(String stringId,
Locale currentLocale,
String defaultValue)
Retreive a resource string using the given locale.
|
String |
getString(String stringId,
String defaultValue)
Retreives a resource string using the current locale, with a default.
|
void |
setCurrentLocale(Locale locale) |
void |
setCurrentLocale(String language) |
void |
setCurrentLocale(String language,
String country) |
public I18n(ResourceBundle guiBundle, ResourceBundle languageBundle)
public static void addOnLanguageChangedListener(LanguageChangedListener listener)
public static Set<String> getResourcesInPackage(Class coreClass, String packageName) throws IOException
The resulting set is deterministically ordered.
coreClass
- Class for class loader to find the resourcespackageName
- The package to enumerateIOException
public void setCurrentLocale(String language)
public void setCurrentLocale(Locale locale)
public Locale getCurrentLocale()
public String getString(String stringId)
stringId
- The resource string identifierpublic String getString(String stringId, String defaultValue)
stringId
- The resource string identifierdefaultValue
- If no resource for the stringID is specified, use
this default valuepublic String getFormattedString(String stringId, String defaultValue, Object... args)
stringId
- The resource string identifierdefaultValue
- The default value for the resource stringargs
- arguments to be inserted into the resource stringpublic String getString(String stringId, Locale currentLocale, String defaultValue)
stringId
- The resource string identifiercurrentLocale
- required Locale for resourcedefaultValue
- The default value for the resource stringpublic static String getCurrentLocaleID()