mondrian.gui
Class I18n

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

public class I18n
extends java.lang.Object


Constructor Summary
I18n(java.util.ResourceBundle guiBundle, java.util.ResourceBundle languageBundle)
           
 
Method Summary
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.util.Locale currentLocale, java.lang.String defaultValue)
          Retreive a resource string using the given locale.
 java.lang.String getString(java.lang.String stringId, java.lang.String defaultValue)
          Retreives a resource string using the current locale, with a default.
 void setCurrentLocale(java.util.Locale locale)
           
 void setCurrentLocale(java.lang.String language)
           
 void setCurrentLocale(java.lang.String language, java.lang.String country)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

I18n

public I18n(java.util.ResourceBundle guiBundle,
            java.util.ResourceBundle languageBundle)
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=30984

The resulting set is deterministically ordered.

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

getCurrentLocaleID

public static java.lang.String getCurrentLocaleID()

Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads