mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-14 07:55:57 +01:00
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:
@@ -9,6 +9,7 @@ import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Locale;
|
||||
|
||||
import emu.grasscutter.Config;
|
||||
import emu.grasscutter.Grasscutter;
|
||||
@@ -306,4 +307,12 @@ public final class Utils {
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* get language code from Locale
|
||||
*/
|
||||
public static String getLanguageCode(Locale locale) {
|
||||
return String.format("%s-%s", locale.getLanguage(), locale.getCountry());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user