Class BrokerULocale


  • public class BrokerULocale
    extends java.lang.Object
    Implements the ULocale locale tags proposal as a series of static methods.

    The various methods in this class take Java locales and standardized POSIX locale tags as defined by X/Open and returns ULocale URNs. It also parses URNs and returns the Java locale or POSIX locale string associated with it.

    This should be regarded merely as a demo or curiousity for now. A real implementation would do more validation.

    Requires wmResourceBundleLoader, v20021030 or later.

    • Constructor Summary

      Constructors 
      Constructor Description
      BrokerULocale()
      Creates new ULocale
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Locale getFormatLocale​(java.lang.String urn)  
      static java.util.Locale getJavaLocale​(java.lang.String urn)  
      static java.lang.String getPosixFromULocale​(java.lang.String urn)  
      static java.util.Locale getResourceLocale​(java.lang.String urn)  
      static java.lang.String getULocale​(java.util.Locale locale)  
      static java.lang.String getULocale​(java.util.Locale resourceLocale, java.util.Locale formatLocale)
      Returns the ULocale string for the given resource and format locales.
      static java.lang.String getULocaleFromPosix​(java.lang.String posix)  
      • Methods inherited from class java.lang.Object

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

      • BrokerULocale

        public BrokerULocale()
        Creates new ULocale
    • Method Detail

      • getULocale

        public static java.lang.String getULocale​(java.util.Locale locale)
      • getULocaleFromPosix

        public static java.lang.String getULocaleFromPosix​(java.lang.String posix)
      • getPosixFromULocale

        public static java.lang.String getPosixFromULocale​(java.lang.String urn)
                                                    throws java.text.ParseException
        Throws:
        java.text.ParseException
      • getJavaLocale

        public static java.util.Locale getJavaLocale​(java.lang.String urn)
                                              throws java.text.ParseException
        Throws:
        java.text.ParseException
      • getULocale

        public static java.lang.String getULocale​(java.util.Locale resourceLocale,
                                                  java.util.Locale formatLocale)
        Returns the ULocale string for the given resource and format locales. The lang portion of the locale will more closely match the resourceLocale and the region portion will more closely match the formatLocale.
      • getResourceLocale

        public static java.util.Locale getResourceLocale​(java.lang.String urn)
                                                  throws java.text.ParseException
        Throws:
        java.text.ParseException
      • getFormatLocale

        public static java.util.Locale getFormatLocale​(java.lang.String urn)
                                                throws java.text.ParseException
        Throws:
        java.text.ParseException