FileDocCategorySizeDatePackage
XResourceBundle.javaAPI DocJava SE 6 API4672Tue Jun 10 00:23:12 BST 2008com.sun.org.apache.xml.internal.utils.res

XResourceBundle

public class XResourceBundle extends ListResourceBundle
The default (english) resource bundle.
xsl.usage
internal

Fields Summary
public static final String
ERROR_RESOURCES
Error resource constants
public static final String
XSLT_RESOURCE
public static final String
LANG_BUNDLE_NAME
public static final String
MULT_ORDER
public static final String
MULT_PRECEDES
public static final String
MULT_FOLLOWS
public static final String
LANG_ORIENTATION
public static final String
LANG_RIGHTTOLEFT
public static final String
LANG_LEFTTORIGHT
public static final String
LANG_NUMBERING
public static final String
LANG_ADDITIVE
public static final String
LANG_MULT_ADD
public static final String
LANG_MULTIPLIER
public static final String
LANG_MULTIPLIER_CHAR
public static final String
LANG_NUMBERGROUPS
public static final String
LANG_NUM_TABLES
public static final String
LANG_ALPHABET
public static final String
LANG_TRAD_ALPHABET
Constructors Summary
Methods Summary
public java.lang.Object[][]getContents()
Get the association list.

return
The association list.

    return new Object[][]
  {
    { "ui_language", "en" }, { "help_language", "en" }, { "language", "en" },
    { "alphabet", new CharArrayWrapper(new char[]{ 'A", 'B", 'C", 'D", 'E", 'F", 'G",
         'H", 'I", 'J", 'K", 'L", 'M", 'N", 'O", 'P", 'Q", 'R", 'S", 'T", 'U", 
         'V", 'W", 'X", 'Y", 'Z" })},
    { "tradAlphabet", new CharArrayWrapper(new char[]{ 'A", 'B", 'C", 'D", 'E", 'F", 
         'G", 'H", 'I", 'J", 'K", 'L", 'M", 'N", 'O", 'P", 'Q", 'R", 'S", 'T", 
         'U", 'V", 'W", 'X", 'Y", 'Z" }) },

    //language orientation
    { "orientation", "LeftToRight" },

    //language numbering   
    { "numbering", "additive" },
  };
  
private static final java.lang.StringgetResourceSuffix(java.util.Locale locale)
Return the resource file suffic for the indicated locale For most locales, this will be based the language code. However for Chinese, we do distinguish between Taiwan and PRC

param
locale the locale
return
an String suffix which canbe appended to a resource name


    String lang = locale.getLanguage();
    String country = locale.getCountry();
    String variant = locale.getVariant();
    String suffix = "_" + locale.getLanguage();

    if (lang.equals("zh"))
      suffix += "_" + country;

    if (country.equals("JP"))
      suffix += "_" + country + "_" + variant;

    return suffix;
  
public static final com.sun.org.apache.xml.internal.utils.res.XResourceBundleloadResourceBundle(java.lang.String className, java.util.Locale locale)
Return a named ResourceBundle for a particular locale. This method mimics the behavior of ResourceBundle.getBundle().

param
className Name of local-specific subclass.
param
locale the locale to prefer when searching for the bundle


                                      
      
               
  

    String suffix = getResourceSuffix(locale);

    //System.out.println("resource " + className + suffix);
    try
    {
      
      // first try with the given locale
      String resourceName = className + suffix;
      return (XResourceBundle) ResourceBundle.getBundle(resourceName, locale);
    }
    catch (MissingResourceException e)
    {
      try  // try to fall back to en_US if we can't load
      {

        // Since we can't find the localized property file,
        // fall back to en_US.
        return (XResourceBundle) ResourceBundle.getBundle(
          XSLT_RESOURCE, new Locale("en", "US"));
      }
      catch (MissingResourceException e2)
      {

        // Now we are really in trouble.
        // very bad, definitely very bad...not going to get very far
        throw new MissingResourceException(
          "Could not load any resource bundles.", className, "");
      }
    }