3 import java.text.MessageFormat;
4 import java.util.Locale;
5 import java.util.ResourceBundle;
6 import java.util.logging.Logger;
10 * @author David Roldan Martinez
11 * @author Thomas Abeel
15 public class MessageManager {
17 private static ResourceBundle rb;
19 private static Logger log=Logger.getLogger(MessageManager.class.getCanonicalName());
21 private static Locale loc = Locale.getDefault();
26 /* Localize Java dialogs */
27 Locale.setDefault(loc);
28 /* Getting messages for GV */
29 log.info("Getting messages for lang: "+loc);
30 rb = ResourceBundle.getBundle("lang.Messages", loc);
31 log.finest("Language keys: "+rb.keySet());
35 public static String getString(String key){
36 String value = "[missing key] " + key;
38 value = rb.getString(key);
40 log.warning("I18N missing: "+loc+"\t"+key);
45 public static Locale getLocale() {
48 public static String formatMessage(String key, Object[] params){
49 return MessageFormat.format(rb.getString(key), params);