(ControlOverrides overrides)
| 875 | } |
| 876 | |
| 877 | private Locale loadLocale(ControlOverrides overrides) { |
| 878 | try { |
| 879 | String lang = null; |
| 880 | if (overrides != null) { |
| 881 | lang = overrides.getOrderedConfigs().get(OptionsParamView.LOCALE); |
| 882 | } |
| 883 | if (lang == null || lang.isEmpty()) { |
| 884 | XMLConfiguration config = new ZapXmlConfiguration(FILE_CONFIG); |
| 885 | config.setAutoSave(false); |
| 886 | |
| 887 | lang = config.getString(OptionsParamView.LOCALE, OptionsParamView.DEFAULT_LOCALE); |
| 888 | if (lang.length() == 0) { |
| 889 | lang = OptionsParamView.DEFAULT_LOCALE; |
| 890 | } |
| 891 | } |
| 892 | |
| 893 | String[] langArray = lang.split("_"); |
| 894 | return new Locale.Builder().setLanguage(langArray[0]).setRegion(langArray[1]).build(); |
| 895 | |
| 896 | } catch (Exception e) { |
| 897 | System.out.println("Failed to load locale " + e); |
| 898 | } |
| 899 | return Locale.ENGLISH; |
| 900 | } |
| 901 | |
| 902 | private void setUpLogging() throws IOException { |
| 903 | backupLegacyLog4jConfig(); |
no test coverage detected