mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-14 14:26:43 -04:00
parent
c9465d89f5
commit
a5ee6b05e8
@ -61,19 +61,44 @@ public final class HMCLGameLauncher extends DefaultLauncher {
|
|||||||
File optionsFile = new File(repository.getRunDirectory(version.getId()), "options.txt");
|
File optionsFile = new File(repository.getRunDirectory(version.getId()), "options.txt");
|
||||||
File configFolder = new File(repository.getRunDirectory(version.getId()), "config");
|
File configFolder = new File(repository.getRunDirectory(version.getId()), "config");
|
||||||
|
|
||||||
if (optionsFile.exists())
|
if (optionsFile.exists()) {
|
||||||
return;
|
return;
|
||||||
if (configFolder.isDirectory())
|
}
|
||||||
if (findFiles(configFolder, "options.txt"))
|
|
||||||
|
if (configFolder.isDirectory()) {
|
||||||
|
if (findFiles(configFolder, "options.txt")) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (I18n.getCurrentLocale().getLocale() != Locale.CHINA) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String lang;
|
||||||
|
/*
|
||||||
|
1.0- :没有语言选项,遇到这些版本时不设置
|
||||||
|
1.1 ~ 5 :zh_CN 时正常,zh_cn 时崩溃(最后两位字母必须大写,否则将会 NPE 崩溃)
|
||||||
|
1.6 ~ 10 :zh_CN 时正常,zh_cn 时自动切换为英文
|
||||||
|
1.11 ~ 12:zh_cn 时正常,zh_CN 时虽然显示了中文但语言设置会错误地显示选择英文
|
||||||
|
1.13+ :zh_cn 时正常,zh_CN 时自动切换为英文
|
||||||
|
*/
|
||||||
|
if (this.version.compareTo(new Version("1.1")) < 0) {
|
||||||
|
lang = null;
|
||||||
|
} else if (this.version.compareTo(new Version("1.10")) <= 0) {
|
||||||
|
lang = "zh_CN";
|
||||||
|
} else {
|
||||||
|
lang = "zh_cn";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lang != null) {
|
||||||
try {
|
try {
|
||||||
// TODO: Dirty implementation here
|
FileUtils.writeText(optionsFile, String.format("lang:%s\nforceUnicodeFont:true\n", lang));
|
||||||
if (I18n.getCurrentLocale().getLocale() == Locale.CHINA)
|
|
||||||
FileUtils.writeText(optionsFile, "lang:zh_CN\nforceUnicodeFont:true\n");
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Logging.LOG.log(Level.WARNING, "Unable to generate options.txt", e);
|
Logging.LOG.log(Level.WARNING, "Unable to generate options.txt", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean findFiles(File folder, String fileName) {
|
private boolean findFiles(File folder, String fileName) {
|
||||||
File[] fs = folder.listFiles();
|
File[] fs = folder.listFiles();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user