Package mondrian.gui
Class I18n
- java.lang.Object
-
- mondrian.gui.I18n
-
public class I18n extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description I18n(java.util.ResourceBundle guiBundle, java.util.ResourceBundle languageBundle)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addOnLanguageChangedListener(LanguageChangedListener listener)
java.util.Locale
getCurrentLocale()
static java.lang.String
getCurrentLocaleID()
java.lang.String
getFormattedString(java.lang.String stringId, java.lang.String defaultValue, java.lang.Object... args)
Retrieves a resource string using the current locale.java.lang.String
getGUIReference(java.lang.String reference)
static java.util.List<java.util.Locale>
getListOfAvailableLanguages(java.lang.Class cl)
static java.util.Set<java.lang.String>
getResourcesInPackage(java.lang.Class coreClass, java.lang.String packageName)
Enumerates the resouces in a give package name.java.lang.String
getString(java.lang.String stringId)
Retreives a resource string using the current locale.java.lang.String
getString(java.lang.String stringId, java.lang.String defaultValue)
Retreives a resource string using the current locale, with a default.java.lang.String
getString(java.lang.String stringId, java.util.Locale currentLocale, java.lang.String defaultValue)
Retreive a resource string using the given locale.void
setCurrentLocale(java.lang.String language)
void
setCurrentLocale(java.lang.String language, java.lang.String country)
void
setCurrentLocale(java.util.Locale locale)
-
-
-
Method Detail
-
addOnLanguageChangedListener
public static void addOnLanguageChangedListener(LanguageChangedListener listener)
-
getListOfAvailableLanguages
public static java.util.List<java.util.Locale> getListOfAvailableLanguages(java.lang.Class cl)
-
getResourcesInPackage
public static java.util.Set<java.lang.String> getResourcesInPackage(java.lang.Class coreClass, java.lang.String packageName) throws java.io.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:
java.io.IOException
-
setCurrentLocale
public void setCurrentLocale(java.lang.String language)
-
setCurrentLocale
public void setCurrentLocale(java.lang.String language, java.lang.String country)
-
setCurrentLocale
public void setCurrentLocale(java.util.Locale locale)
-
getCurrentLocale
public java.util.Locale getCurrentLocale()
-
getGUIReference
public java.lang.String getGUIReference(java.lang.String reference)
-
getString
public java.lang.String getString(java.lang.String stringId)
Retreives a resource string using the current locale.- Parameters:
stringId
- The resource string identifier- Returns:
- The locale specific string
-
getString
public java.lang.String getString(java.lang.String stringId, java.lang.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 java.lang.String getFormattedString(java.lang.String stringId, java.lang.String defaultValue, java.lang.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 java.lang.String getString(java.lang.String stringId, java.util.Locale currentLocale, java.lang.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 java.lang.String getCurrentLocaleID()
-
-