Adjust locale for invalid ISO code, fixes #1682

This commit is contained in:
PikaMug 2021-05-10 01:10:24 -04:00
parent 3b5dae8466
commit dca23a4e8a
2 changed files with 2 additions and 2 deletions

View File

@ -386,7 +386,7 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
final TimeZone tz = TimeZone.getTimeZone(date[6]);
cal.setTimeZone(tz);
final String[] iso = Lang.getISO().split("-");
final Locale loc = new Locale(iso[0], iso[1]);
final Locale loc = iso.length > 1 ? new Locale(iso[0], iso[1]) : new Locale(iso[0]);
final Double zhour = (double) (cal.getTimeZone().getRawOffset() / 60 / 60 / 1000);
final String[] sep = String.valueOf(zhour).replace("-", "").split("\\.");
final DecimalFormat zoneFormat = new DecimalFormat("00");

View File

@ -133,7 +133,7 @@ public class Lang {
+ File.separator + "strings_new.yml");
final boolean exists_new = langFile_new.exists();
final LinkedHashMap<String, String> allStrings = new LinkedHashMap<String, String>();
if (langFile.exists()) {
if (langFile.exists() && iso.split("-").length > 1) {
final FileConfiguration config= YamlConfiguration
.loadConfiguration(new InputStreamReader(new FileInputStream(langFile), "UTF-8"));
FileConfiguration config_new = null;