Fix the following issues:

1. HashMap non-thread-safe issus
2. Fix the same problem in pr621, but use a better implementation

Add the following functions:
1. There is now a language cache inside getLanguage to prepare for different languages corresponding to different time zones where the accounts in the server are located
This commit is contained in:
Secretboy-SMR
2022-05-09 17:30:51 +08:00
committed by Melledy
parent d179b5c7dc
commit 5a37acde2b
4 changed files with 22 additions and 12 deletions

View File

@@ -149,14 +149,7 @@ public final class Grasscutter {
public static void loadLanguage() {
var locale = config.LocaleLanguage;
var languageTag = locale.toLanguageTag();
if (languageTag.equals("und")) {
Grasscutter.getLogger().error("Illegal locale language, using 'en-US' instead.");
language = Language.getLanguage("en-US");
} else {
language = Language.getLanguage(languageTag);
}
language = Language.getLanguage(Utils.getLanguageCode(locale));
}
public static void saveConfig() {