Package mondrian.gui

Class I18n


  • public class I18n
    extends Object
    • Method Detail

      • addOnLanguageChangedListener

        public static void addOnLanguageChangedListener​(LanguageChangedListener listener)
      • getListOfAvailableLanguages

        public static List<Locale> getListOfAvailableLanguages​(Class cl)
      • 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=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:
        IOException
      • 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)
        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 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)
        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 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()