import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;
+import java.util.logging.Level;
import java.util.logging.Logger;
/**
private static Logger log=Logger.getLogger(MessageManager.class.getCanonicalName());
- private static Locale loc = Locale.getDefault();
+ private static Locale loc;
static{
+ try {
/* Localize Java dialogs */
- Locale.setDefault(loc);
+ loc = Locale.getDefault();
+ // Locale.setDefault(loc);
/* Getting messages for GV */
log.info("Getting messages for lang: "+loc);
rb = ResourceBundle.getBundle("lang.Messages", loc);
- log.finest("Language keys: "+rb.keySet());
+ if (log.isLoggable(Level.FINEST)) {
+ // this might take a while, so we only do it if it will be shown
+ log.finest("Language keys: "+rb.keySet());
+ }
+ } catch (Exception q) {
+ log.warning("Exception when initting Locale for i18n messages\n"+q.getMessage());
+ q.printStackTrace();
+ }
+ catch (Error v)
+ {
+ log.warning("Error when initting Locale for i18n messages\n"+v.getMessage());
+ v.printStackTrace();
+ }
+
}
try{
value = rb.getString(key);
}catch(Exception e){
- log.warning("I18N missing: "+loc+"\t"+key);
+ log.warning("I18N missing: "+loc+"\t"+key);
}
return value;
}