1 22 23 package org.continuent.sequoia.common.i18n; 24 25 import java.text.MessageFormat ; 26 import java.util.ResourceBundle ; 27 28 34 public abstract class I18N 35 { 36 43 public static String get(ResourceBundle bundle, String key) 44 { 45 try 46 { 47 return bundle.getString(key); 48 } 49 catch (Exception e) 50 { 51 return key; 52 } 53 } 54 55 63 public static String get(ResourceBundle bundle, String key, boolean parameter) 64 { 65 return MessageFormat.format(get(bundle, key), new Object []{String 66 .valueOf(parameter)}); 67 } 68 69 77 public static String get(ResourceBundle bundle, String key, int parameter) 78 { 79 return MessageFormat.format(get(bundle, key), new Object []{String 80 .valueOf(parameter)}); 81 } 82 83 91 public static String get(ResourceBundle bundle, String key, long parameter) 92 { 93 return MessageFormat.format(get(bundle, key), new Object []{String 94 .valueOf(parameter)}); 95 } 96 97 108 public static String get(ResourceBundle bundle, String key, 109 Object [] parameters) 110 { 111 return MessageFormat.format(get(bundle, key), parameters); 112 } 113 114 122 public static String get(ResourceBundle bundle, String key, Object parameter) 123 { 124 return MessageFormat.format(get(bundle, key), new Object []{parameter}); 125 } 126 127 } | Popular Tags |