-public class MessageManager {
-
- private static ResourceBundle rb;
-
- private static Logger log=Logger.getLogger(MessageManager.class.getCanonicalName());
-
- private static Locale loc = Locale.getDefault();
-
-
-
- static{
- /* Localize Java dialogs */
- 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());
-
+public class MessageManager
+{
+
+ private static ResourceBundle rb;
+
+ private static Logger log = Logger.getLogger(MessageManager.class
+ .getCanonicalName());
+
+ private static Locale loc;
+
+ static
+ {
+ try
+ {
+ /* Localize Java dialogs */
+ loc = Locale.getDefault();
+ // Locale.setDefault(loc);
+ /* Getting messages for GV */
+ log.info("Getting messages for lang: " + loc);
+ rb = ResourceBundle.getBundle("lang.Messages", loc);
+ 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();
+ }
+
+ }
+
+ public static String getString(String key)
+ {
+ String value = "[missing key] " + key;
+ try
+ {
+ value = rb.getString(key);
+ } catch (Exception e)
+ {
+ log.warning("I18N missing: " + loc + "\t" + key);