@Test public void findsZh() throws IOException { File zh = new File(dir, "index_zh.html"); zh.createNewFile(); IOException[] mal = { null }; URL url = BrowserBuilder.findLocalizedResourceURL("index.html", Locale.SIMPLIFIED_CHINESE, mal, BrowserBuilder.class); assertEquals(url, zh.toURI().toURL(), "Found one suffix"); }
static URL findLocalizedResourceURL(String resource, Locale l, IOException[] mal, Class<?> relativeTo) { URL url = null; if (l != null) { url = findResourceURL(resource, "_" + l.getLanguage() + "_" + l.getCountry(), mal, relativeTo); if (url != null) { return url; } url = findResourceURL(resource, "_" + l.getLanguage(), mal, relativeTo); } if (url != null) { return url; } return findResourceURL(resource, null, mal, relativeTo); }
BrowserBuilder { static URL findLocalizedResourceURL(String resource, Locale l, IOException[] mal, Class<?> relativeTo) { URL url = null; if (l != null) { url = findResourceURL(resource, "_" + l.getLanguage() + "_" + l.getCountry(), mal, relativeTo); if (url != null) { return url; } url = findResourceURL(resource, "_" + l.getLanguage(), mal, relativeTo); } if (url != null) { return url; } return findResourceURL(resource, null, mal, relativeTo); } }
BrowserBuilder { static URL findLocalizedResourceURL(String resource, Locale l, IOException[] mal, Class<?> relativeTo) { URL url = null; if (l != null) { url = findResourceURL(resource, "_" + l.getLanguage() + "_" + l.getCountry(), mal, relativeTo); if (url != null) { return url; } url = findResourceURL(resource, "_" + l.getLanguage(), mal, relativeTo); } if (url != null) { return url; } return findResourceURL(resource, null, mal, relativeTo); } private  BrowserBuilder(Object[] context); }
BrowserBuilder { static URL findLocalizedResourceURL(String resource, Locale l, IOException[] mal, Class<?> relativeTo) { URL url = null; if (l != null) { url = findResourceURL(resource, "_" + l.getLanguage() + "_" + l.getCountry(), mal, relativeTo); if (url != null) { return url; } url = findResourceURL(resource, "_" + l.getLanguage(), mal, relativeTo); } if (url != null) { return url; } return findResourceURL(resource, null, mal, relativeTo); } private  BrowserBuilder(Object[] context); static BrowserBuilder newBrowser(Object... context); BrowserBuilder loadClass(Class<?> mainClass); BrowserBuilder loadFinished(Runnable r); BrowserBuilder loadPage(String page); BrowserBuilder locale(Locale locale); BrowserBuilder invoke(String methodName, String... args); BrowserBuilder classloader(ClassLoader l); void showAndWait(); }
BrowserBuilder { static URL findLocalizedResourceURL(String resource, Locale l, IOException[] mal, Class<?> relativeTo) { URL url = null; if (l != null) { url = findResourceURL(resource, "_" + l.getLanguage() + "_" + l.getCountry(), mal, relativeTo); if (url != null) { return url; } url = findResourceURL(resource, "_" + l.getLanguage(), mal, relativeTo); } if (url != null) { return url; } return findResourceURL(resource, null, mal, relativeTo); } private  BrowserBuilder(Object[] context); static BrowserBuilder newBrowser(Object... context); BrowserBuilder loadClass(Class<?> mainClass); BrowserBuilder loadFinished(Runnable r); BrowserBuilder loadPage(String page); BrowserBuilder locale(Locale locale); BrowserBuilder invoke(String methodName, String... args); BrowserBuilder classloader(ClassLoader l); void showAndWait();  }