Skip to content

Commit 9e8953b

Browse files
Split language files.
1 parent 123c530 commit 9e8953b

3 files changed

Lines changed: 85 additions & 80 deletions

File tree

src/main/kotlin/NoMathExpectation/chatExchange/neoForged/CustomLanguage.kt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,19 @@ fun languageOf(lang: String, server: MinecraftServer): Language {
5050
val textMap = mutableMapOf<String, String>()
5151
val componentMap = mutableMapOf<String, Component>()
5252

53-
CustomLanguage::class.java.getResourceAsStream("/assets/chatexchange/mclang/$lang.json")?.use {
54-
Language.loadFromJson(it, textMap::put, componentMap::put)
53+
fun loadFrom(path: String) {
54+
CustomLanguage::class.java.getResourceAsStream(path)?.use {
55+
Language.loadFromJson(it, textMap::put, componentMap::put)
56+
} ?: logger.warn("Unable to load language file $path")
5557
}
5658

57-
CustomLanguage::class.java.getResourceAsStream("/assets/chatexchange/neolang/$lang.json")?.use {
58-
Language.loadFromJson(it, textMap::put, componentMap::put)
59-
}
59+
loadFrom("/assets/chatexchange/mclang/$lang.json") // vanilla
60+
loadFrom("/assets/chatexchange/fmllang/$lang.json") // fml
61+
loadFrom("/assets/chatexchange/neolang/$lang.json") // neoforge
6062

61-
textMap += I18nManager.loadTranslations(lang)
63+
textMap += I18nManager.loadTranslations(lang) // i18n
6264

65+
// mods
6366
val langFile = String.format(Locale.ROOT, "lang/%s.json", lang)
6467
val resourceManager = server.serverResources.resourceManager
6568
val clientResources = MultiPackResourceManager(PackType.CLIENT_RESOURCES, resourceManager.listPacks().toList())
@@ -77,7 +80,7 @@ fun languageOf(lang: String, server: MinecraftServer): Language {
7780
}
7881
1
7982
}.sum()
80-
logger.debug("Loaded {} language files for {}", loaded, lang)
83+
logger.debug("Loaded {} mod language files for {}", loaded, lang)
8184

8285
return CustomLanguage(textMap, componentMap)
8386
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"fml.loadingerrorscreen.errorheader": "模组加载出错\n加载时发生了 {0,choice,1#1个错误|1<{0}个错误}",
3+
"fml.loadingerrorscreen.warningheader": "加载模组时的{0,choice,1#警告|1<警告}\n加载模组时发生了 {0,choice,1#1 个警告|1<{0} 个警告}",
4+
"fml.modloadingissue.language.missingversion": "模组文件 {101} 需要语言提供模组 {0}:{1,vr} 才能加载\n§7我们找到 {2,i18n,fml.messages.artifactversion}",
5+
"fml.modloading.missingclasses": "模组文件 {3} 有已声明但未找到的模组",
6+
"fml.modloading.missingmetadata": "mods.toml 缺少模组 id {3} 的元数据",
7+
"fml.modloadingissue.failedtoloadmodclass": "{100,modinfo,name} ({100,modinfo,id}) 有类加载错误\n§7{102,exc,msg}",
8+
"fml.modloadingissue.failedtoloadmod": "{100,modinfo,name}({100,modinfo,id})未能正确加载\n§7{102,exc,msg}",
9+
"fml.modloadingissue.feature.missing": "{100,modinfo,name}({100,modinfo,id})缺少运行所需的一个功能\n§7需要 {0,featurebound} 但 {1} 可用",
10+
"fml.modloadingissue.uncaughterror": "发生了一个未捕获的并行处理错误。\n§7{102,exc,msg}",
11+
"fml.modloadingissue.errorduringevent": "{100,modinfo,name}({100,modinfo,id})在 {0} 事件调度时发生错误\n§7{102,exc,msg}",
12+
"fml.modloading.failedtoloadforge": "加载 NeoForge 失败",
13+
"fml.modloadingissue.javafml.dangling_entrypoint": "文件 {2} 包含模组 §e{0}§r 的入口点 §6{1}§r,但该模组不存在或不在同一文件内。\n您是否忘记在入口点中更新模组 ID?",
14+
"fml.modloadingissue.missingdependency": "模组 §e{1}§r 需要 §6{0}§r §o{2,vr}§r\n§7目前 §6{0}§r§7 是 §o{3,i18n,fml.messages.artifactversion.ornotinstalled}}\n{4,optional,§7使用此依赖的原因:§r}",
15+
"fml.modloadingissue.missingdependency.optional": "模组 §e{1}§r 只支持 §3{0}§r §o{2,vr}§r\n§7目前,§3{0}§r§7 是 §o{3}",
16+
"fml.modloadingissue.incompatiblemod": "模组 §e{1}§r 与 §3{0}§r §o{2,vr}§r §c不兼容§r\n§7目前 §3{0}§r§7 是 §o{3}\n§7因为:§r §o{4,i18ntranslate}§r",
17+
"fml.modloadingissue.discouragedmod": "模组 §e{1}§r §d不推荐§r 使用 §3{0}§r §o{2,vr}§r\n§7目前 §3{0}§r§7 是 §o{3}\n§7因为:§r §o{4,i18ntranslate}§r",
18+
"fml.modloadingissue.discouragedmod.proceed": "若继续,自行承担风险",
19+
"fml.modloadingissue.duplicate_mod": "模组 §e{0}§r 存在于多个文件:{1}",
20+
"fml.modloading.duplicate_library": "库 §e{3}§r 存在于多个文件:{4}",
21+
"fml.modloading.incompatiblemod.noreason": "§e未提供理由§r",
22+
"fml.modloading.discouragedmod.noreason": "§e未提供理由§r",
23+
"fml.modloadingissue.dependencyloading.conflictingdependencies": "有些模组要求的版本与下列模组冲突:§6{0}§r。由 §e{1}§r请求。",
24+
"fml.modloadingissue.dependencyloading.mismatchedcontaineddependencies": "有些模组已经提供了一个可以接受的版本范围:§6{0}§r,但没有提供与之匹配的 jar。 由 §e{1}§r 请求。",
25+
"fml.modloadingissue.coremod_error": "从 {1} 加载 core-mod {0} 时出错",
26+
"fml.modloadingissue.corrupted_installation": "你的 NeoForge 安装损坏了,请尝试重新安装",
27+
"fml.modloadingissue.cycle": "检测到模组依赖循环:{0}",
28+
"fml.modloading.failedtoprocesswork": "{0,modinfo,name}({0,modinfo,id})在处理延迟工作时发生错误\n§7{2,exc,msg}",
29+
"fml.modloadingissue.brokenfile": "文件 {101} 不是有效的模组文件",
30+
"fml.modloadingissue.brokenfile.unknown": "文件 {101} 不是一个有效的模组文件",
31+
"fml.modloadingissue.brokenfile.oldforge": "{101} 为老版本的 Minecraft Forge 设计,不能被加载。",
32+
"fml.modloadingissue.brokenfile.minecraft_forge": "{101} 为 Minecraft Forge 老版本的 NeoForge 设计,不能被加载。",
33+
"fml.modloadingissue.brokenfile.liteloader": "文件 {101} 是 LiteLoader 模组,无法加载",
34+
"fml.modloadingissue.brokenfile.fabric": "文件 {101} 是 Fabric 模组,无法加载",
35+
"fml.modloadingissue.brokenfile.optifine": "文件 {101} 是不兼容的 OptiFine 版本",
36+
"fml.modloadingissue.brokenfile.bukkit": "文件 {101} 是 Bukkit 或其他 Bukkit 实现(Spigot、Paper 等)的插件,不能加载",
37+
"fml.modloadingissue.brokenfile.invalidzip": "文件 {101} 不是 jar 文件",
38+
"fml.modloadingissue.brokenresources": "文件 {101} 加载有效的 ResourcePackInfo 失败",
39+
"fml.modloadingissue.technical_error": "加载模组时出现技术性错误:{0}",
40+
"fml.modloadingissue.invalid_maven_coordinate": "以下 Maven 坐标无效:{0}",
41+
"fml.modloadingissue.maven_coordinate_not_found": "{1} 内的 Maven 坐标 {0} 处找不到模组",
42+
"fml.modloadingissue.failed_to_list_folder_content": "列出目录 {0} 内容失败",
43+
"fml.modloadingissue.failed_to_find_on_classpath": "在类路径上找不到 {0}",
44+
"fml.modloadingissue.multiple_copies_on_classpath": "在类路径上找到多个 {0} 的副本:{1}",
45+
"fml.messages.artifactversion.ornotinstalled": "{0,ornull,fml.messages.artifactversion.notinstalled}",
46+
"fml.messages.artifactversion": "{0,ornull,fml.messages.artifactversion.none}",
47+
"fml.messages.artifactversion.none": "",
48+
"fml.messages.artifactversion.notinstalled": "§n未安装",
49+
"fml.messages.version.restriction.any": "任一",
50+
"fml.messages.version.restriction.lower.inclusive": "{0} 或以上",
51+
"fml.messages.version.restriction.lower.exclusive": "{0} 以上",
52+
"fml.messages.version.restriction.upper.inclusive": "{0} 或以下",
53+
"fml.messages.version.restriction.upper.exclusive": "{0} 以下",
54+
"fml.messages.version.restriction.bounded": "{0} 和 {1} 之间",
55+
"fml.messages.version.restriction.bounded.inclusive": "{0} 和 {1} 之间(含)",
56+
"fml.messages.version.restriction.bounded.exclusive": "{0} 和 {1} 之间(不含)",
57+
"fml.messages.version.restriction.bounded.lowerexclusive": "{0} 以上,或 {1} 或更低",
58+
"fml.messages.version.restriction.bounded.upperexclusive": "{0} 或以上,并低于 {1}",
59+
"fml.modloadingissue.enumextender.file_not_found": "由模组{100,modinfo,id}提供的扩展文件{0}不存在",
60+
"fml.modloadingissue.enumextender.invalid_enum_name": "模组{100,modinfo,id}定义的枚举{0}的类描述符无效",
61+
"fml.modloadingissue.enumextender.field_name.missing_prefix": "模组{100,modinfo,id}为类{1}定义的枚举{0}的名称必须以其模组ID开头",
62+
"fml.modloadingissue.enumextender.field_name.invalid": "模组{100,modinfo,id}为类{1}定义的枚举{0}的名称无效",
63+
"fml.modloadingissue.enumextender.invalid_constructor": "模组{100,modinfo,id}为类{1}定义的构造函数{0}的描述符无效",
64+
"fml.modloadingissue.enumextender.argument.reference.invalid_src_class": "Parameter source class {0} for field {1} in enum {2}, specified by mod {100,modinfo,id}, is not a valid class descriptor",
65+
"fml.modloadingissue.enumextender.argument.reference.invalid_src_method": "Parameter source method {0} for field {1} in enum {2}, specified by mod {100,modinfo,id}, is not a valid method name",
66+
"fml.modloadingissue.enumextender.argument.reference.invalid_src_field": "Parameter source field {0} for field {1} in enum {2}, specified by mod {100,modinfo,id}, is not a valid field name",
67+
"fml.modloadingissue.enumextender.argument.reference.unexpected_decl": "Unexpected reference parameter declaration {0} for field {1} in enum {2}, specified by mod {100,modinfo,id}",
68+
"fml.modloadingissue.enumextender.argument.unexpected_decl": "Unexpected parameter declaration {0} for field {1} in enum {2}, specified by mod {100,modinfo,id}",
69+
"fml.modloadingissue.enumextender.loading_error": "Failed to load enum extension data at {0} in mod {100,modinfo,id}: {102,exc,msg}",
70+
"fml.modloadingissue.enumextender.argument.constant.count_mismatch": "Parameter count {0} does not match argument count {1} of constructor {2} for field {3} in enum {4}, specified by mod {100,modinfo,id}",
71+
"fml.modloadingissue.enumextender.argument.constant.invalid_char": "Invalid character {0} at parameter index {1} for field {2} in enum {3}, specified by mod {100,modinfo,id}",
72+
"fml.modloadingissue.enumextender.argument.constant.unsupported_type": "Unsupported immediate argument type {0} at parameter index {1} for field {2} in enum {3}, specified by mod {100,modinfo,id}",
73+
"fml.modloadingissue.enumextender.duplicate": "Found duplicate field {0} for enum {1}, provided by mods {2} and {3}"
74+
}

src/main/resources/assets/chatexchange/neolang/zh_cn.json

Lines changed: 1 addition & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -243,77 +243,5 @@
243243
"neoforge.network.data_maps.missing_their": "无法连接至服务器,因为客户端上不存在必要的注册表数据映射:%s",
244244
"neoforge.network.extensible_enums.no_vanilla_server": "该客户端不支持原版服务器,因为它在服务器端网络中使用了不同连接方式。",
245245
"neoforge.network.extensible_enums.enum_set_mismatch": "客户端和服务器上的模组不匹配。请确保您使用的 NeoForge 版本与服务器上的版本相同。",
246-
"neoforge.network.extensible_enums.enum_entry_mismatch": "客户端和服务器上所需要的模组不匹配。请确保您使用的模组和 NeoForge 版本与服务器上的版本相同。请查看日志以获取更多详细信息。",
247-
"fml.loadingerrorscreen.errorheader": "模组加载出错\n加载时发生了 {0,choice,1#1个错误|1<{0}个错误}",
248-
"fml.loadingerrorscreen.warningheader": "加载模组时的{0,choice,1#警告|1<警告}\n加载模组时发生了 {0,choice,1#1 个警告|1<{0} 个警告}",
249-
"fml.modloadingissue.language.missingversion": "模组文件 {101} 需要语言提供模组 {0}:{1,vr} 才能加载\n§7我们找到 {2,i18n,fml.messages.artifactversion}",
250-
"fml.modloading.missingclasses": "模组文件 {3} 有已声明但未找到的模组",
251-
"fml.modloading.missingmetadata": "mods.toml 缺少模组 id {3} 的元数据",
252-
"fml.modloadingissue.failedtoloadmodclass": "{100,modinfo,name} ({100,modinfo,id}) 有类加载错误\n§7{102,exc,msg}",
253-
"fml.modloadingissue.failedtoloadmod": "{100,modinfo,name}({100,modinfo,id})未能正确加载\n§7{102,exc,msg}",
254-
"fml.modloadingissue.feature.missing": "{100,modinfo,name}({100,modinfo,id})缺少运行所需的一个功能\n§7需要 {0,featurebound} 但 {1} 可用",
255-
"fml.modloadingissue.uncaughterror": "发生了一个未捕获的并行处理错误。\n§7{102,exc,msg}",
256-
"fml.modloadingissue.errorduringevent": "{100,modinfo,name}({100,modinfo,id})在 {0} 事件调度时发生错误\n§7{102,exc,msg}",
257-
"fml.modloading.failedtoloadforge": "加载 NeoForge 失败",
258-
"fml.modloadingissue.javafml.dangling_entrypoint": "文件 {2} 包含模组 §e{0}§r 的入口点 §6{1}§r,但该模组不存在或不在同一文件内。\n您是否忘记在入口点中更新模组 ID?",
259-
"fml.modloadingissue.missingdependency": "模组 §e{1}§r 需要 §6{0}§r §o{2,vr}§r\n§7目前 §6{0}§r§7 是 §o{3,i18n,fml.messages.artifactversion.ornotinstalled}}\n{4,optional,§7使用此依赖的原因:§r}",
260-
"fml.modloadingissue.missingdependency.optional": "模组 §e{1}§r 只支持 §3{0}§r §o{2,vr}§r\n§7目前,§3{0}§r§7 是 §o{3}",
261-
"fml.modloadingissue.incompatiblemod": "模组 §e{1}§r 与 §3{0}§r §o{2,vr}§r §c不兼容§r\n§7目前 §3{0}§r§7 是 §o{3}\n§7因为:§r §o{4,i18ntranslate}§r",
262-
"fml.modloadingissue.discouragedmod": "模组 §e{1}§r §d不推荐§r 使用 §3{0}§r §o{2,vr}§r\n§7目前 §3{0}§r§7 是 §o{3}\n§7因为:§r §o{4,i18ntranslate}§r",
263-
"fml.modloadingissue.discouragedmod.proceed": "若继续,自行承担风险",
264-
"fml.modloadingissue.duplicate_mod": "模组 §e{0}§r 存在于多个文件:{1}",
265-
"fml.modloading.duplicate_library": "库 §e{3}§r 存在于多个文件:{4}",
266-
"fml.modloading.incompatiblemod.noreason": "§e未提供理由§r",
267-
"fml.modloading.discouragedmod.noreason": "§e未提供理由§r",
268-
"fml.modloadingissue.dependencyloading.conflictingdependencies": "有些模组要求的版本与下列模组冲突:§6{0}§r。由 §e{1}§r请求。",
269-
"fml.modloadingissue.dependencyloading.mismatchedcontaineddependencies": "有些模组已经提供了一个可以接受的版本范围:§6{0}§r,但没有提供与之匹配的 jar。 由 §e{1}§r 请求。",
270-
"fml.modloadingissue.coremod_error": "从 {1} 加载 core-mod {0} 时出错",
271-
"fml.modloadingissue.corrupted_installation": "你的 NeoForge 安装损坏了,请尝试重新安装",
272-
"fml.modloadingissue.cycle": "检测到模组依赖循环:{0}",
273-
"fml.modloading.failedtoprocesswork": "{0,modinfo,name}({0,modinfo,id})在处理延迟工作时发生错误\n§7{2,exc,msg}",
274-
"fml.modloadingissue.brokenfile": "文件 {101} 不是有效的模组文件",
275-
"fml.modloadingissue.brokenfile.unknown": "文件 {101} 不是一个有效的模组文件",
276-
"fml.modloadingissue.brokenfile.oldforge": "{101} 为老版本的 Minecraft Forge 设计,不能被加载。",
277-
"fml.modloadingissue.brokenfile.minecraft_forge": "{101} 为 Minecraft Forge 老版本的 NeoForge 设计,不能被加载。",
278-
"fml.modloadingissue.brokenfile.liteloader": "文件 {101} 是 LiteLoader 模组,无法加载",
279-
"fml.modloadingissue.brokenfile.fabric": "文件 {101} 是 Fabric 模组,无法加载",
280-
"fml.modloadingissue.brokenfile.optifine": "文件 {101} 是不兼容的 OptiFine 版本",
281-
"fml.modloadingissue.brokenfile.bukkit": "文件 {101} 是 Bukkit 或其他 Bukkit 实现(Spigot、Paper 等)的插件,不能加载",
282-
"fml.modloadingissue.brokenfile.invalidzip": "文件 {101} 不是 jar 文件",
283-
"fml.modloadingissue.brokenresources": "文件 {101} 加载有效的 ResourcePackInfo 失败",
284-
"fml.modloadingissue.technical_error": "加载模组时出现技术性错误:{0}",
285-
"fml.modloadingissue.invalid_maven_coordinate": "以下 Maven 坐标无效:{0}",
286-
"fml.modloadingissue.maven_coordinate_not_found": "{1} 内的 Maven 坐标 {0} 处找不到模组",
287-
"fml.modloadingissue.failed_to_list_folder_content": "列出目录 {0} 内容失败",
288-
"fml.modloadingissue.failed_to_find_on_classpath": "在类路径上找不到 {0}",
289-
"fml.modloadingissue.multiple_copies_on_classpath": "在类路径上找到多个 {0} 的副本:{1}",
290-
"fml.messages.artifactversion.ornotinstalled": "{0,ornull,fml.messages.artifactversion.notinstalled}",
291-
"fml.messages.artifactversion": "{0,ornull,fml.messages.artifactversion.none}",
292-
"fml.messages.artifactversion.none": "",
293-
"fml.messages.artifactversion.notinstalled": "§n未安装",
294-
"fml.messages.version.restriction.any": "任一",
295-
"fml.messages.version.restriction.lower.inclusive": "{0} 或以上",
296-
"fml.messages.version.restriction.lower.exclusive": "{0} 以上",
297-
"fml.messages.version.restriction.upper.inclusive": "{0} 或以下",
298-
"fml.messages.version.restriction.upper.exclusive": "{0} 以下",
299-
"fml.messages.version.restriction.bounded": "{0} 和 {1} 之间",
300-
"fml.messages.version.restriction.bounded.inclusive": "{0} 和 {1} 之间(含)",
301-
"fml.messages.version.restriction.bounded.exclusive": "{0} 和 {1} 之间(不含)",
302-
"fml.messages.version.restriction.bounded.lowerexclusive": "{0} 以上,或 {1} 或更低",
303-
"fml.messages.version.restriction.bounded.upperexclusive": "{0} 或以上,并低于 {1}",
304-
"fml.modloadingissue.enumextender.file_not_found": "由模组{100,modinfo,id}提供的扩展文件{0}不存在",
305-
"fml.modloadingissue.enumextender.invalid_enum_name": "模组{100,modinfo,id}定义的枚举{0}的类描述符无效",
306-
"fml.modloadingissue.enumextender.field_name.missing_prefix": "模组{100,modinfo,id}为类{1}定义的枚举{0}的名称必须以其模组ID开头",
307-
"fml.modloadingissue.enumextender.field_name.invalid": "模组{100,modinfo,id}为类{1}定义的枚举{0}的名称无效",
308-
"fml.modloadingissue.enumextender.invalid_constructor": "模组{100,modinfo,id}为类{1}定义的构造函数{0}的描述符无效",
309-
"fml.modloadingissue.enumextender.argument.reference.invalid_src_class": "Parameter source class {0} for field {1} in enum {2}, specified by mod {100,modinfo,id}, is not a valid class descriptor",
310-
"fml.modloadingissue.enumextender.argument.reference.invalid_src_method": "Parameter source method {0} for field {1} in enum {2}, specified by mod {100,modinfo,id}, is not a valid method name",
311-
"fml.modloadingissue.enumextender.argument.reference.invalid_src_field": "Parameter source field {0} for field {1} in enum {2}, specified by mod {100,modinfo,id}, is not a valid field name",
312-
"fml.modloadingissue.enumextender.argument.reference.unexpected_decl": "Unexpected reference parameter declaration {0} for field {1} in enum {2}, specified by mod {100,modinfo,id}",
313-
"fml.modloadingissue.enumextender.argument.unexpected_decl": "Unexpected parameter declaration {0} for field {1} in enum {2}, specified by mod {100,modinfo,id}",
314-
"fml.modloadingissue.enumextender.loading_error": "Failed to load enum extension data at {0} in mod {100,modinfo,id}: {102,exc,msg}",
315-
"fml.modloadingissue.enumextender.argument.constant.count_mismatch": "Parameter count {0} does not match argument count {1} of constructor {2} for field {3} in enum {4}, specified by mod {100,modinfo,id}",
316-
"fml.modloadingissue.enumextender.argument.constant.invalid_char": "Invalid character {0} at parameter index {1} for field {2} in enum {3}, specified by mod {100,modinfo,id}",
317-
"fml.modloadingissue.enumextender.argument.constant.unsupported_type": "Unsupported immediate argument type {0} at parameter index {1} for field {2} in enum {3}, specified by mod {100,modinfo,id}",
318-
"fml.modloadingissue.enumextender.duplicate": "Found duplicate field {0} for enum {1}, provided by mods {2} and {3}"
246+
"neoforge.network.extensible_enums.enum_entry_mismatch": "客户端和服务器上所需要的模组不匹配。请确保您使用的模组和 NeoForge 版本与服务器上的版本相同。请查看日志以获取更多详细信息。"
319247
}

0 commit comments

Comments
 (0)