1 16 19 package com.sun.org.apache.xml.internal.utils.res; 20 21 import java.util.ListResourceBundle ; 22 import java.util.Locale ; 23 import java.util.MissingResourceException ; 24 import java.util.ResourceBundle ; 25 26 30 public class XResourceBundle extends ListResourceBundle 31 { 32 33 34 public static final String ERROR_RESOURCES = 35 "com.sun.org.apache.xalan.internal.res.XSLTErrorResources", XSLT_RESOURCE = 36 "com.sun.org.apache.xml.internal.utils.res.XResourceBundle", LANG_BUNDLE_NAME = 37 "com.sun.org.apache.xml.internal.utils.res.XResources", MULT_ORDER = 38 "multiplierOrder", MULT_PRECEDES = "precedes", MULT_FOLLOWS = 39 "follows", LANG_ORIENTATION = "orientation", LANG_RIGHTTOLEFT = 40 "rightToLeft", LANG_LEFTTORIGHT = "leftToRight", LANG_NUMBERING = 41 "numbering", LANG_ADDITIVE = "additive", LANG_MULT_ADD = 42 "multiplicative-additive", LANG_MULTIPLIER = 43 "multiplier", LANG_MULTIPLIER_CHAR = 44 "multiplierChar", LANG_NUMBERGROUPS = "numberGroups", LANG_NUM_TABLES = 45 "tables", LANG_ALPHABET = "alphabet", LANG_TRAD_ALPHABET = "tradAlphabet"; 46 47 54 public static final XResourceBundle loadResourceBundle( 55 String className, Locale locale) throws MissingResourceException 56 { 57 58 String suffix = getResourceSuffix(locale); 59 60 try 62 { 63 64 String resourceName = className + suffix; 66 return (XResourceBundle) ResourceBundle.getBundle(resourceName, locale); 67 } 68 catch (MissingResourceException e) 69 { 70 try { 72 73 return (XResourceBundle) ResourceBundle.getBundle( 76 XSLT_RESOURCE, new Locale ("en", "US")); 77 } 78 catch (MissingResourceException e2) 79 { 80 81 throw new MissingResourceException ( 84 "Could not load any resource bundles.", className, ""); 85 } 86 } 87 } 88 89 97 private static final String getResourceSuffix(Locale locale) 98 { 99 100 String lang = locale.getLanguage(); 101 String country = locale.getCountry(); 102 String variant = locale.getVariant(); 103 String suffix = "_" + locale.getLanguage(); 104 105 if (lang.equals("zh")) 106 suffix += "_" + country; 107 108 if (country.equals("JP")) 109 suffix += "_" + country + "_" + variant; 110 111 return suffix; 112 } 113 114 119 protected Object [][] getContents() { 120 Object [][] msgCopy = new Object [contents.length][2]; 124 for (int i = 0; i < contents.length; i++) { 125 msgCopy[i][0] = contents[i][0]; 126 msgCopy[i][1] = contents[i][1]; 127 } 128 return msgCopy; 129 } 130 131 132 static final Object [][] contents = 133 { 134 { "ui_language", "en" }, { "help_language", "en" }, { "language", "en" }, 135 { "alphabet", 136 new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 137 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 138 'Y', 'Z' } }, 139 { "tradAlphabet", 140 new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 141 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 142 'Y', 'Z' } }, 143 144 { "orientation", "LeftToRight" }, 146 147 { "numbering", "additive" }, 149 }; 150 } 151 | Popular Tags |