fix: can't run as named module

This commit is contained in:
Haowei Wen 2021-09-01 16:39:53 +08:00
parent b700ad6b0c
commit 832c029db6
No known key found for this signature in database
GPG Key ID: 5BC167F73EA558E4

View File

@ -22,6 +22,7 @@ import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import org.jackhuang.hmcl.util.Lang;
import org.jackhuang.hmcl.util.Lazy;
import org.jackhuang.hmcl.util.platform.JavaVersion;
import java.io.IOException;
import java.text.SimpleDateFormat;
@ -107,7 +108,12 @@ public final class Locales {
SupportedLocale(Locale locale, String name) {
this.locale = locale;
this.name = name;
resourceBundle = ResourceBundle.getBundle("assets.lang.I18N", locale, UTF8Control.INSTANCE);
if (JavaVersion.CURRENT_JAVA.getParsedVersion() == JavaVersion.JAVA_8) {
resourceBundle = ResourceBundle.getBundle("assets.lang.I18N", locale, UTF8Control.INSTANCE);
} else {
// UTF-8 is supported in Java 9+
resourceBundle = ResourceBundle.getBundle("assets.lang.I18N", locale);
}
}
public Locale getLocale() {