Package mondrian.gui
Class I18n
- java.lang.Object
-
- mondrian.gui.I18n
-
public class I18n extends Object
-
-
Constructor Summary
Constructors Constructor Description I18n(ResourceBundle guiBundle, ResourceBundle languageBundle)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddOnLanguageChangedListener(LanguageChangedListener listener)LocalegetCurrentLocale()static StringgetCurrentLocaleID()StringgetFormattedString(String stringId, String defaultValue, Object... args)Retrieves a resource string using the current locale.StringgetGUIReference(String reference)static List<Locale>getListOfAvailableLanguages(Class cl)static Set<String>getResourcesInPackage(Class coreClass, String packageName)Enumerates the resouces in a give package name.StringgetString(String stringId)Retreives a resource string using the current locale.StringgetString(String stringId, String defaultValue)Retreives a resource string using the current locale, with a default.StringgetString(String stringId, Locale currentLocale, String defaultValue)Retreive a resource string using the given locale.voidsetCurrentLocale(String language)voidsetCurrentLocale(String language, String country)voidsetCurrentLocale(Locale locale)
-
-
-
Constructor Detail
-
I18n
public I18n(ResourceBundle guiBundle, ResourceBundle languageBundle)
-
-
Method Detail
-
addOnLanguageChangedListener
public static void addOnLanguageChangedListener(LanguageChangedListener listener)
-
getResourcesInPackage
public static Set<String> getResourcesInPackage(Class coreClass, String packageName) throws IOException
Enumerates the resouces in a give package name. This works even if the resources are loaded from a jar file! Adapted from code by mikewse on the java.sun.com message boards. http://forum.java.sun.com/thread.jsp?forum=22&thread=30984The resulting set is deterministically ordered.
- Parameters:
coreClass- Class for class loader to find the resourcespackageName- The package to enumerate- Returns:
- A Set of Strings for each resouce in the package.
- Throws:
IOException
-
setCurrentLocale
public void setCurrentLocale(String language)
-
setCurrentLocale
public void setCurrentLocale(Locale locale)
-
getCurrentLocale
public Locale getCurrentLocale()
-
getString
public String getString(String stringId)
Retreives a resource string using the current locale.- Parameters:
stringId- The resource string identifier- Returns:
- The locale specific string
-
getString
public String getString(String stringId, String defaultValue)
Retreives a resource string using the current locale, with a default.- Parameters:
stringId- The resource string identifierdefaultValue- If no resource for the stringID is specified, use this default value- Returns:
- The locale specific string
-
getFormattedString
public String getFormattedString(String stringId, String defaultValue, Object... args)
Retrieves a resource string using the current locale.- Parameters:
stringId- The resource string identifierdefaultValue- The default value for the resource stringargs- arguments to be inserted into the resource string- Returns:
- The locale specific string
-
getString
public String getString(String stringId, Locale currentLocale, String defaultValue)
Retreive a resource string using the given locale. Use the default if there is nothing for the given Locale.- Parameters:
stringId- The resource string identifiercurrentLocale- required Locale for resourcedefaultValue- The default value for the resource string- Returns:
- The locale specific string
-
getCurrentLocaleID
public static String getCurrentLocaleID()
-
-