mondrian.gui
Class I18n

java.lang.Object
  extended by mondrian.gui.I18n

public class I18n
extends Object

 

Field Summary
static Vector<LanguageChangedListener> languageChangedListeners
           
 
Constructor Summary
I18n(ResourceBundle guiBundle, ResourceBundle languageBundle)
           
 
Method Summary
static void addOnLanguageChangedListener(LanguageChangedListener listener)
           
 Locale getCurrentLocale()
           
static String getCurrentLocaleID()
           
 String getFormattedString(String stringID, String defaultValue, Object[] args)
          Retreive a resource string using the current locale.
 String getGUIReference(String reference)
           
static List getListOfAvailableLanguages(Class cl)
           
static Set getResourcesInPackage(Class coreClass, String packageName)
          Enumerates the resouces in a give package name.
 String getString(String stringID)
          Retreive 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)
          Retreive a resource string using the current locale, with a default.
 void setCurrentLocale(Locale locale)
           
 void setCurrentLocale(String language)
           
 void setCurrentLocale(String language, String country)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

languageChangedListeners

public static Vector<LanguageChangedListener> languageChangedListeners
Constructor Detail

I18n

public I18n(ResourceBundle guiBundle,
            ResourceBundle languageBundle)
Method Detail

addOnLanguageChangedListener

public static void addOnLanguageChangedListener(LanguageChangedListener listener)

getListOfAvailableLanguages

public static List getListOfAvailableLanguages(Class cl)

getResourcesInPackage

public static Set 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=30984

Throws:
IOException
Parameters:
coreClass - Class for class loader to find the resources
packageName - The package to enumerate
Returns:
A Set of Strings for each resouce in the package.

setCurrentLocale

public void setCurrentLocale(String language)

setCurrentLocale

public void setCurrentLocale(String language,
                             String country)

setCurrentLocale

public void setCurrentLocale(Locale locale)

getCurrentLocale

public Locale getCurrentLocale()

getGUIReference

public String getGUIReference(String reference)

getString

public String getString(String stringID)
Retreive 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)
Retreive a resource string using the current locale, with a default.

Parameters:
stringID - The resource string identifier
defaultValue - 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)
Retreive a resource string using the current locale.

Parameters:
stringID - The resource string identifier
defaultValue - The default value for the resource string
args - 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 identifier
currentLocale - required Locale for resource
defaultValue - The default value for the resource string
Returns:
The locale specific string

getCurrentLocaleID

public static String getCurrentLocaleID()

SourceForge.net_Logo