1 16 19 package org.apache.xml.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 "org.apache.xalan.res.XSLTErrorResources", XSLT_RESOURCE = 36 "org.apache.xml.utils.res.XResourceBundle", LANG_BUNDLE_NAME = 37 "org.apache.xml.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 public Object [][] getContents() 120 { 121 return contents; 122 } 123 124 125 static final Object [][] contents = 126 { 127 { "ui_language", "en" }, { "help_language", "en" }, { "language", "en" }, 128 { "alphabet", 129 new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 130 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 131 'Y', 'Z' } }, 132 { "tradAlphabet", 133 new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 134 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 135 'Y', 'Z' } }, 136 137 { "orientation", "LeftToRight" }, 139 140 { "numbering", "additive" }, 142 }; 143 } 144 | Popular Tags |