diff --git a/src/main/java/emu/grasscutter/Configuration.java b/src/main/java/emu/grasscutter/Configuration.java index 66fc2fe37..486c5d33c 100644 --- a/src/main/java/emu/grasscutter/Configuration.java +++ b/src/main/java/emu/grasscutter/Configuration.java @@ -26,6 +26,7 @@ public final class Configuration extends ConfigContainer { public static final Locale LANGUAGE = config.language.language; public static final Locale FALLBACK_LANGUAGE = config.language.fallback; + public static final String DOCUMENT_LANGUAGE = config.language.document; private static final String DATA_FOLDER = config.folderStructure.data; private static final String RESOURCES_FOLDER = config.folderStructure.resources; private static final String PLUGINS_FOLDER = config.folderStructure.plugins; diff --git a/src/main/java/emu/grasscutter/server/http/documentation/GachaMappingRequestHandler.java b/src/main/java/emu/grasscutter/server/http/documentation/GachaMappingRequestHandler.java index e405d9b54..ef7298410 100644 --- a/src/main/java/emu/grasscutter/server/http/documentation/GachaMappingRequestHandler.java +++ b/src/main/java/emu/grasscutter/server/http/documentation/GachaMappingRequestHandler.java @@ -5,11 +5,10 @@ import static emu.grasscutter.Configuration.RESOURCE; import com.google.gson.reflect.TypeToken; import emu.grasscutter.Grasscutter; import emu.grasscutter.data.GameData; -import emu.grasscutter.data.ResourceLoader; import emu.grasscutter.data.def.AvatarData; import emu.grasscutter.data.def.ItemData; -import emu.grasscutter.tools.Tools; import emu.grasscutter.utils.Utils; +import static emu.grasscutter.Configuration.DOCUMENT_LANGUAGE; import express.http.Request; import express.http.Response; import java.io.FileInputStream; @@ -27,8 +26,7 @@ final class GachaMappingRequestHandler implements DocumentationHandler { private Map map; GachaMappingRequestHandler() { - ResourceLoader.loadResources(); - final String textMapFile = "TextMap/TextMap" + Tools.getLanguageOption() + ".json"; + final String textMapFile = "TextMap/TextMap" + DOCUMENT_LANGUAGE + ".json"; try (InputStreamReader fileReader = new InputStreamReader(new FileInputStream( Utils.toFilePath(RESOURCE(textMapFile))), StandardCharsets.UTF_8)) { map = Grasscutter.getGsonFactory().fromJson(fileReader, diff --git a/src/main/java/emu/grasscutter/server/http/documentation/HandbookRequestHandler.java b/src/main/java/emu/grasscutter/server/http/documentation/HandbookRequestHandler.java index 65250d12c..faf533024 100644 --- a/src/main/java/emu/grasscutter/server/http/documentation/HandbookRequestHandler.java +++ b/src/main/java/emu/grasscutter/server/http/documentation/HandbookRequestHandler.java @@ -1,19 +1,16 @@ package emu.grasscutter.server.http.documentation; -import static emu.grasscutter.Configuration.DATA; -import static emu.grasscutter.Configuration.RESOURCE; +import static emu.grasscutter.Configuration.*; import static emu.grasscutter.utils.Language.translate; import com.google.gson.reflect.TypeToken; import emu.grasscutter.Grasscutter; import emu.grasscutter.command.CommandMap; import emu.grasscutter.data.GameData; -import emu.grasscutter.data.ResourceLoader; import emu.grasscutter.data.def.AvatarData; import emu.grasscutter.data.def.ItemData; import emu.grasscutter.data.def.MonsterData; import emu.grasscutter.data.def.SceneData; -import emu.grasscutter.tools.Tools; import emu.grasscutter.utils.FileUtils; import emu.grasscutter.utils.Utils; import express.http.Request; @@ -35,7 +32,6 @@ final class HandbookRequestHandler implements DocumentationHandler { public HandbookRequestHandler() { - ResourceLoader.loadResources(); final File templateFile = new File(Utils.toFilePath(DATA("documentation/handbook.html"))); if (templateFile.exists()) { template = new String(FileUtils.read(templateFile), StandardCharsets.UTF_8); @@ -44,7 +40,7 @@ final class HandbookRequestHandler implements DocumentationHandler { template = null; } - final String textMapFile = "TextMap/TextMap" + Tools.getLanguageOption() + ".json"; + final String textMapFile = "TextMap/TextMap" + DOCUMENT_LANGUAGE + ".json"; try (InputStreamReader fileReader = new InputStreamReader(new FileInputStream( Utils.toFilePath(RESOURCE(textMapFile))), StandardCharsets.UTF_8)) { map = Grasscutter.getGsonFactory() diff --git a/src/main/java/emu/grasscutter/server/http/documentation/RootRequestHandler.java b/src/main/java/emu/grasscutter/server/http/documentation/RootRequestHandler.java index 56a68cac8..12b738bf3 100644 --- a/src/main/java/emu/grasscutter/server/http/documentation/RootRequestHandler.java +++ b/src/main/java/emu/grasscutter/server/http/documentation/RootRequestHandler.java @@ -17,7 +17,6 @@ final class RootRequestHandler implements DocumentationHandler { private final String template; public RootRequestHandler() { - ResourceLoader.loadResources(); final File templateFile = new File(Utils.toFilePath(DATA("documentation/index.html"))); if (templateFile.exists()) { template = new String(FileUtils.read(templateFile), StandardCharsets.UTF_8); diff --git a/src/main/java/emu/grasscutter/utils/ConfigContainer.java b/src/main/java/emu/grasscutter/utils/ConfigContainer.java index 7171caf92..2d44659f5 100644 --- a/src/main/java/emu/grasscutter/utils/ConfigContainer.java +++ b/src/main/java/emu/grasscutter/utils/ConfigContainer.java @@ -104,6 +104,7 @@ public class ConfigContainer { public static class Language { public Locale language = Locale.getDefault(); public Locale fallback = Locale.US; + public String document = "EN"; } public static class Account { diff --git a/data/documentation/handbook.html b/src/main/resources/defaults/data/documentation/handbook.html similarity index 100% rename from data/documentation/handbook.html rename to src/main/resources/defaults/data/documentation/handbook.html diff --git a/data/documentation/index.html b/src/main/resources/defaults/data/documentation/index.html similarity index 100% rename from data/documentation/index.html rename to src/main/resources/defaults/data/documentation/index.html