1 23 24 29 30 package org.apache.tools.ant.taskdefs.optional.sun.appserv; 31 32 import java.util.ResourceBundle ; 34 import java.util.Vector ; 35 import java.util.Properties ; 36 import java.util.Iterator ; 37 import java.util.MissingResourceException ; 38 import java.text.MessageFormat ; 39 40 46 public class LocalStringsManager { 47 48 private String packageName = "org.apache.tools.ant.taskdefs.optional.sun.appserv"; 49 private String propertyFile = "LocalStrings"; 50 private ResourceBundle resourceBundle = null; 51 52 53 54 public LocalStringsManager() 55 { 56 this.resourceBundle = ResourceBundle.getBundle(packageName + "." + propertyFile); 57 } 58 59 62 public String getPropertiesFile() 63 { 64 return propertyFile; 65 } 66 67 70 public String getPackageName() 71 { 72 return packageName; 73 } 74 75 78 public String getString(String key) 79 { 80 String value = ""; 81 try 82 { 83 value = resourceBundle.getString(key); 84 } 85 catch (MissingResourceException mre) 86 { 87 } 89 return value; 90 } 91 92 93 96 public String getString(String key, Object [] toInsert) 97 { 98 String fmtStr = ""; 99 try 100 { 101 MessageFormat msgFormat = 102 new MessageFormat (getString(key)); 103 fmtStr = msgFormat.format(toInsert); 104 } 105 catch(Exception e) 106 { 107 } 108 return fmtStr; 109 } 110 } 111 | Popular Tags |