1 18 19 package sync4j.syncclient.demo; 20 21 import java.util.Hashtable ; 22 import java.util.Locale ; 23 import java.util.ResourceBundle ; 24 25 31 public class Language { 32 33 35 public final static String LANGUAGE_FILE = "resources/language_us" ; 36 public final static Locale LANGUAGE_LOCALE = Locale.US ; 37 38 40 41 private static Hashtable languageHash = new Hashtable (); 42 43 45 public static String getString (String key) { 46 47 ResourceBundle rb = null ; 48 Object valueFromHash = null ; 49 String value = null ; 50 51 valueFromHash = languageHash.get(key); 52 53 if (valueFromHash != null) { 54 return (String ) valueFromHash; 55 } 56 57 rb = ResourceBundle.getBundle(LANGUAGE_FILE, LANGUAGE_LOCALE); 58 59 value = rb.getString(key); 60 61 languageHash.put(key, value); 62 63 return value; 64 65 } 66 67 } | Popular Tags |