// 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
} catch (Exception e)
{
String msg = "I18N missing: " + loc + "\t" + key;
- logWarning(key, msg);
+ logWarning(key, msg);
}
return value;
}
} catch (Exception x)
{
String msg = "I18N missing key with root " + keyroot + ": " + loc + "\t"
- + smkey;
- logWarning(smkey, msg);
+ + smkey;
+ logWarning(smkey, msg);
}
return name;
}
*/
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);
+ }
}
}
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Date;
+import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.logging.ConsoleHandler;
return id + (frameType == null ? "" : "-" + frameType);
}
+
+ /**
+ * Option to avoid unnecessary seeking of nonexistent resources in JavaScript.
+ * Works in Java as well.
+ *
+ * @param loc
+ * @return
+ */
+ public static Locale getLocaleOrNone(Locale loc)
+ {
+ return (isJS && loc.getCountry() == "en" ? new Locale("") : loc);
+ }
+
}