1 23 package com.sun.enterprise.instance; 24 25 import com.sun.enterprise.util.i18n.StringManager; 26 import com.sun.enterprise.config.ConfigException; 27 28 42 43 class Localizer 44 { 45 private Localizer() 46 { 47 } 48 49 51 static String getValue(ExceptionType type) 52 { 53 String key = type.getString(); 54 55 if(localStrings == null) 56 return key; 57 58 try 59 { 60 return localStrings.getStringWithDefault(key, key); 61 } 62 catch(Exception e) 63 { 64 return key; 65 } 66 } 67 68 70 static String getValue(ExceptionType type, String arg1of1) 71 { 72 return getValue(type, new Object [] { arg1of1 }); 73 } 74 75 77 static String getValue(ExceptionType type, int arg1of1) 78 { 79 return getValue(type, new Object [] { new Integer (arg1of1) }); 80 } 81 82 84 static String getValue(ExceptionType type, Object [] objs) 85 { 86 if(objs == null || objs.length <= 0) 87 return getValue(type); 88 89 String key = type.getString(); 90 91 if(localStrings == null) 92 return key; 93 94 try 95 { 96 return localStrings.getStringWithDefault(key, key, objs); 97 } 98 catch(Exception e) 99 { 100 return key; 101 } 102 } 103 104 106 private static StringManager localStrings; 107 108 static 109 { 110 try 111 { 112 localStrings = StringManager.getManager(Localizer.class.getPackage().getName()); 113 } 114 catch(Exception e) 115 { 116 localStrings = null; 118 } 119 } 120 } 121 | Popular Tags |