From: BobHanson Date: Mon, 8 Jun 2020 21:59:00 +0000 (-0500) Subject: Plartform update X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=28a49b46297ea3228ae90bb86dbc4b73f5130fb5;hp=f8e41805cd23482f89eff4ae5e57578098ae12ab;p=jalview.git Plartform update --- diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index 728110e..eec1e2a 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -35,6 +35,8 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.net.URL; +import java.util.Locale; +import java.util.Map; import java.util.Properties; import java.util.logging.ConsoleHandler; import java.util.logging.Level; @@ -49,6 +51,8 @@ import com.stevesoft.pat.Regex; import swingjs.api.JSUtilI; +////////THIS FILE IS NOW OUTDATED ///////////// + /** * System platform information used by Applet and Application * @@ -639,7 +643,7 @@ public class Platform String key = ""; String value = ""; @SuppressWarnings("unused") - Object info = jsutil.getAppletAttribute("__Info"); + Object info = getAppletInfo(null); /** * @j2sNative for (key in info) { value = info[key]; */ @@ -810,4 +814,22 @@ public class Platform } + @SuppressWarnings("unchecked") + public static Object getAppletInfo(String key) + { + return (isJS ? (Map) jsutil.getAppletInfo(key) : null); + } + + /** + * 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); + } + }