Skip to content

Commit

Permalink
#175 Fix config loading of locale strings
Browse files Browse the repository at this point in the history
  • Loading branch information
rheimus committed Apr 7, 2020
1 parent 5e46826 commit 7c02763
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/com/superzanti/serversync/SyncConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,13 @@ private void writeConfig() {
private void init() {
String couldNotFindString = "Could not find %s config entry";
try {
LOCALE = new Locale(config.getEntryByName("LOCALE").getString());
String localeString = config.getEntryByName("LOCALE").getString();
String[] localeParts = localeString.split("_");
if (localeParts.length != 2) {
Logger.error("Malformed locale string!");
localeParts = new String[]{"en", "US"};
}
LOCALE = new Locale(localeParts[0], localeParts[1]);
} catch (NullPointerException e) {
Logger.debug(String.format(couldNotFindString, "LOCALE"));
isUsingIncompatableConfig = true;
Expand Down

0 comments on commit 7c02763

Please sign in to comment.