+ // Load the external language file, either from config file or from command line params
+ if (langFilename == null && !overrideLang) {
+ // If langfilename is blank on command line parameters then don't use setting from config
+ langFilename = Config.getConfigString(Config.KEY_LANGUAGE_FILE);
+ }
+ if (langFilename != null && !langFilename.equals("")) {
+ try {
+ I18nManager.addLanguageFile(langFilename);
+ Config.setConfigString(Config.KEY_LANGUAGE_FILE, langFilename);
+ }
+ catch (FileNotFoundException fnfe) {
+ System.err.println("Failed to load language file: " + langFilename);
+ }
+ }
+ // Set up the window and go
+ launch(dataFiles);
+ }
+
+
+ /**
+ * Choose a locale based on the given code
+ * @param inString code for locale
+ * @return Locale object if available, otherwise null
+ */
+ private static Locale getLanguage(String inString)
+ {
+ if (inString.length() == 2)
+ {
+ return new Locale(inString);
+ }
+ else if (inString.length() == 5 && inString.charAt(2) == '_')
+ {
+ return new Locale(inString.substring(0, 2), inString.substring(3));
+ }
+ System.out.println("Unrecognised locale '" + inString
+ + "' - value should be eg 'DE' or 'DE_ch'");
+ return null;