1 18 package org.apache.beehive.netui.util; 19 20 import java.text.MessageFormat ; 21 import java.util.ResourceBundle ; 22 23 26 public class Bundle 27 { 28 29 private static final String BUNDLE_NAME = "org.apache.beehive.netui.util.netui"; 30 31 32 private Bundle(){} 33 34 38 private static ResourceBundle getBundle() 39 { 40 return ResourceBundle.getBundle(BUNDLE_NAME); 41 } 42 43 44 47 public static String getString(String aKey) 48 { 49 try 50 { 51 return getBundle().getString(aKey); 52 } 53 catch(Exception e) 54 { 55 return getString("System_StringNotFound",new Object []{aKey}); 56 } 57 } 58 59 65 public static String getString(String aKey, Object arg) 66 { 67 return getString(aKey,new Object []{arg}); 68 } 69 70 76 public static String getString(String aKey, Object [] args) 77 { 78 String pattern = getBundle().getString(aKey); 79 MessageFormat format = new MessageFormat (pattern); 80 81 return format.format(args).toString(); 82 } 83 84 87 public static String getErrorString(String aKey, Object [] args) 88 { 89 String pattern = getBundle().getString(aKey); 90 MessageFormat format = new MessageFormat (pattern); 91 92 return format.format(args); 93 } 94 95 public static String getErrorString(String aKey) 96 { 97 return getBundle().getString(aKey); 98 } 99 100 } 101 | Popular Tags |