+ {
+ // Check if a data file has been given
+ File f = new File(arg);
+ if (f.exists() && f.canRead()) {
+ dataFiles.add(f);
+ }
+ else {
+ System.out.println("Unknown parameter '" + arg + "'.");
+ showUsage = true;
+ }
+ }
+ }
+ if (showUsage) {
+ System.out.println("Possible parameters:"
+ + "\n --configfile=<file> used to specify a configuration file"
+ + "\n --lang=<code> or --locale=<code> used to specify language"
+ + "\n --langfile=<file> used to specify an alternative language file\n");
+ }
+ // Initialise configuration if selected
+ try
+ {
+ if (configFilename != null) {
+ Config.loadFile(new File(configFilename));
+ }
+ else {
+ Config.loadDefaultFile();
+ }
+ }
+ catch (ConfigException ce) {
+ System.err.println("Failed to load config file: " + configFilename);
+ }
+ boolean overrideLang = (locale != null);
+ if (overrideLang) {
+ // Make sure Config holds chosen language
+ Config.setConfigString(Config.KEY_LANGUAGE_CODE, localeCode);
+ }
+ else {
+ // Set locale according to Config's language property
+ String configLang = Config.getConfigString(Config.KEY_LANGUAGE_CODE);
+ if (configLang != null) {
+ Locale configLocale = getLanguage(configLang);
+ if (configLocale != null) {locale = configLocale;}
+ }