Class ProwideLocale


  • public final class ProwideLocale
    extends java.lang.Object
    Helper class to manage default supported locales
    Since:
    7.7
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String[] SUPPORTED_LANGS  
    • Constructor Summary

      Constructors 
      Constructor Description
      ProwideLocale()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.ResourceBundle getBundle​(java.lang.Class<?> clazz)
      Safe get locale, checking if current locale is supported Same as getBundle(clazz, Locale.getDefault()))
      static java.util.ResourceBundle getBundle​(java.lang.Class<?> clazz, java.util.Locale locale)
      Get requested bundle or ENGLISH if missing resource for the given locale.
      static java.util.ResourceBundle getBundle​(java.lang.String resource)
      Safe get locale, checking if current locale is supported Same as getBundle(resource, Locale.getDefault()))
      static java.util.ResourceBundle getBundle​(java.lang.String resource, java.util.Locale locale)
      Get requested bundle or ENGLISH if missing resource for the given locale.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SUPPORTED_LANGS

        public static java.lang.String[] SUPPORTED_LANGS
    • Constructor Detail

      • ProwideLocale

        public ProwideLocale()
    • Method Detail

      • getBundle

        public static java.util.ResourceBundle getBundle​(java.lang.Class<?> clazz,
                                                         java.util.Locale locale)
        Get requested bundle or ENGLISH if missing resource for the given locale. Uses the calss FQN (with package) for the resource location.
        Parameters:
        clazz - the class for which the resource bundle is loaded
        locale - a locale
        Returns:
        the bundle for the given class and locale or English if not found.
        Since:
        7.7
      • getBundle

        public static java.util.ResourceBundle getBundle​(java.lang.Class<?> clazz)
        Safe get locale, checking if current locale is supported Same as getBundle(clazz, Locale.getDefault()))
        Parameters:
        clazz - class object for lookup of the resource bundle
        Returns:
        resource bundle
        Since:
        7.7
        See Also:
        getBundle(Class, Locale)
      • getBundle

        public static java.util.ResourceBundle getBundle​(java.lang.String resource,
                                                         java.util.Locale locale)
        Get requested bundle or ENGLISH if missing resource for the given locale.
        Parameters:
        resource - the name of the resource bundle to loaded
        locale - a locale
        Returns:
        the bundle for the given resource name and locale or English if not found.
        Since:
        7.9.7
      • getBundle

        public static java.util.ResourceBundle getBundle​(java.lang.String resource)
        Safe get locale, checking if current locale is supported Same as getBundle(resource, Locale.getDefault()))
        Parameters:
        resource - name of the resource bundle, a fully qualified class name
        Returns:
        resource bundle
        Since:
        7.9.7
        See Also:
        getBundle(String, Locale)