Merge commit 'alpha/update_2_12_for_2_11_2_series_merge^2' into HEAD
[jalview.git] / src / jalview / util / MessageManager.java
index 43b6c9e..5f6674c 100644 (file)
@@ -57,9 +57,7 @@ public class MessageManager
       // Locale.setDefault(loc);
       /* Getting messages for GV */
       log.info("Getting messages for lang: " + loc);
-      if (Platform.isJS() && loc.getLanguage().equals("en"))
-        loc = new Locale(""); // meaning no language properties are available
-      rb = ResourceBundle.getBundle("lang.Messages", loc, Control.getControl(Control.FORMAT_PROPERTIES));
+      rb = ResourceBundle.getBundle("lang.Messages", Platform.getLocaleOrNone(loc), Control.getControl(Control.FORMAT_PROPERTIES));
       // if (log.isLoggable(Level.FINEST))
       // {
       // // this might take a while, so we only do it if it will be shown
@@ -95,7 +93,7 @@ public class MessageManager
     } catch (Exception e)
     {
       String msg = "I18N missing: " + loc + "\t" + key;
-         logWarning(key, msg);
+    logWarning(key, msg);
     }
     return value;
   }
@@ -163,15 +161,15 @@ public class MessageManager
    */
   public static String getStringOrReturn(String keyroot, String name)
   {
-    String smkey = keyroot + name.toLowerCase().replaceAll(" ", "");
+    String smkey = keyroot + name.toLowerCase(Locale.ROOT).replaceAll(" ", "");
     try
     {
       name = rb.getString(smkey);
     } catch (Exception x)
     {
       String msg = "I18N missing key with root " + keyroot + ": " + loc + "\t"
-                         + smkey;
-         logWarning(smkey, msg);
+              + smkey;
+    logWarning(smkey, msg);
     }
     return name;
   }
@@ -184,10 +182,10 @@ public class MessageManager
    */
   private static void logWarning(String key, String msg) 
   {
-       if (!reportedMissing.contains(key))
-       {
+  if (!reportedMissing.contains(key))
+  {
       reportedMissing.add(key);
-         log.info(msg);
-       }
+    log.info(msg);
+  }
   }
 }