WTEM (World Translation Extractor Mod)
English | 中文
WTEM 是一个客户端侧的 Fabric 模组,它将 Minecraft 世界、世界数据包(world data packs)和世界生成的结构中的硬编码文本转换为翻译键(translation keys),并写入对应的 i18n 条目。它支持多个 Minecraft 版本。
本模组的某些部分是在 AI 辅助下创建的。使用的 AI 工具包括 gpt-5.6-sol 和 claude-opus-5。
支持的版本
| Release |
Game versions |
Java |
1.21.1 |
1.21 ~ 1.21.1 |
21 |
1.21.3 |
1.21.2 ~ 1.21.3 |
21 |
1.21.4 |
1.21.4 |
21 |
1.21.5 |
1.21.5 |
21 |
1.21.8 |
1.21.6 ~ 1.21.8 |
21 |
1.21.10 |
1.21.9 ~ 1.21.10 |
21 |
1.21.11 |
1.21.11 |
21 |
26.1.x |
26.1 ~ 26.1.2 |
25 |
26.2.x |
26.2 |
25 |
使用方法
- 将对应你 Minecraft 版本的模组文件放入客户端的
mods 目录中。
- 启动游戏,在单人世界列表中选择目标世界并打开其“编辑”页面。
- 点击“Extract”按钮。
- 在备份确认页面上创建备份。强烈建议始终进行备份;提取操作会就地修改世界数据。
- 等待提取完成。屏幕会显示区块进度和警告数量;详细信息可在游戏日志中找到。
提取开始后也可以取消。在取消或发生错误之前已经写入的区块、SavedData 和结构不会回滚,因此请先备份。
提取内容
保存数据(Save data):
- 区块中的方块实体文本,例如容器名称、告示牌和命令方块输出。
- 实体及其嵌套数据中的文本:乘客、装备、物品栏、村民交易。
- 记分板队伍、目标和分数显示名称。
- 自定义Boss条名称。
- 实际存在于世界
generated/<namespace>/structure(s) 中的 NBT 结构。
- 位于世界
data/ 目录下的每个非原版压缩 *.dat SavedData 文件,包括嵌套的自定义文件,采用保守的字段检测以及按文件或路径过滤。所选范围内的每个 NBT 字符串都会记录一条 saved_data_string 警告;只有被识别为文本组件的字符串才会被提取。可识别的字段名称可通过 saved_data_text_fields 进行配置(默认包含 back_text)。
数据包(Datapacks):
- advancement、附魔、唱片机歌曲、盔甲纹饰、画作、乐器、对话和维度类型中的已知文本字段(例如
attributes.minecraft:gameplay/bed_rule.error_message)。
- 物品修饰符、战利品表和谓词中的可翻译文本组件。
- NBT 结构中的实体、方块实体和物品文本。
- 函数中的文本组件参数、
summon 命令中 nbt 参数的实体文本,以及解析为物品或方块实体的参数,例如 give 的物品组件和 setblock、fill 的方块实体 NBT。
输出结果
一次完整的提取可能会生成:
<world>/en_us.json:从翻译键到原始文本的映射。
<world>/en_us.csv:提取报告,记录每段文本的发现位置。见下一节。
<world>/datapacks/<original pack>_<short hash>_wtem/:与原始世界数据包配对的覆盖用数据包。
- 默认客户端资源包
resources.zip,在 26.1 版本之前位于 <world>/ 下,在 26.1 及更高版本中位于 <world>/resourcepacks/ 下。
- 修改后的方块实体、实体、记分板、
bossbar 和结构,其中硬编码的文本组件已被替换为翻译组件。
WTEM 不会修改原始的世界数据包。
生成的新数据包仅保存实际更改的资源以及 pack.mcmeta。
在进入世界之前,请在数据包配置中确认覆盖数据包已启用且位于原始数据包之上。
提取报告
提取还会导出一个报告,文件名以语言文件命名并带有 .csv 后缀。
其列含义如下:
| Column |
Contents |
key |
生成的翻译键。 |
text |
被替换的原始文本。 |
source |
提取阶段,即配置中 stages 所使用的名称,例如 region 或 datapacks。 |
location |
数据所在位置:维度和区块、数据包和资源 ID,或结构文件。 |
subject |
包含对象的链,从最外层开始,由 > 连接,例如 minecraft:chest (12, 64, -30) > minecraft:shulker_box。 |
reused |
此实例是否复用了现有的键。true 表示未添加语言文件条目,且编辑该键会影响不止一个位置。 |
replaced |
原始世界/数据包的值是否被替换为翻译组件。false 标识仅为编录性质的文本,而非被替换的内容。 |
如果一个键出现在多个位置,则语言文件中只有一个条目,但报告中每个出现位置都有一行,因此报告的行数通常多于语言文件的条目数。如果提取中途取消或失败,已写入的部分会与语言文件一起导出。
警告类型
警告是非致命诊断信息。每条警告都包含其类型以及导致该警告的源文件、资源 ID、命令或 NBT 路径。
以下警告标识了需要审查或无法安全重写的情况。
| 类型 |
含义 |
region_snbt |
无法写入每个区域的 SNBT 导出文件。 |
saved_data |
无法读取、解压缩、解析或选择某个 SavedData 文件。 |
saved_data_string |
在选定的 SavedData 作用域中发现了纯字符串。除非它位于配置的文字字段中,否则保持不变。 |
datapack |
无法读取或处理数据包资源。 |
datapack_staging |
无法暂存或发布生成的覆盖数据包。 |
function_index |
无法为数据包构建函数调用索引。 |
function_parse |
Minecraft 的命令解析器无法解析某个函数命令。 |
function_command |
已解析的命令无法进行处理。 |
function_reparse |
重写后的命令未通过验证性重新解析。 |
function_component_rewrite |
函数中的文本组件或结构化参数无法安全地重写。 |
function_selector_name |
无法解析看起来像携带文本参数的选择器名称。 |
function_storage_string |
字面量字符串被直接写入命令存储区(通过 data modify storage ... set value)。 |
function_macro_binding |
缺少宏调用者/存储绑定,或者绑定不明确且无法静态解析。 |
function_macro_restore |
无法还原并验证其调用者的具象化宏命令。 |
writable_book |
可编辑书的 writable_book_content.pages[*].raw 字符串已被编目,但无法替换为组件(replaced=false)。 |
written_book_string |
已书写书的纯字符串(如 author)保持不变。 |
generated_structure |
无法读取或重写世界生成的结构。 |
language |
无法写入主语言目录。 |
manifest |
无法写入 CSV 提取报告。 |
schema |
无法写入可选的提取模式。 |
resource_pack |
无法写入可选的客户端资源包。 |
ai_key_naming |
AI 语义键命名失败或返回了无效键;将使用结构化命名作为回退方案。 |
ai_translation |
AI 翻译请求或响应失败;保留常规目录。 |
close |
运行结束后,无法干净地关闭某个提取资源。 |
配置
首次启动时,会将默认配置文件写入 config/wtem.json,其中所有选项均以其默认值明确列出,以便直接编辑。
所有选项均为可选:删除某项或忽略该项将使系统保持默认行为。
你也可以通过点击提取界面中的“Configuration”按钮来访问 YACL 配置界面。
提取界面上的“Select sources”按钮会打开一个 YACL 屏幕,用于选择数据包、SavedData 文件和实体/方块实体类型。
“Configuration”按钮则用于其他提取设置。
外部编辑 wtem.json 会自动热重载。
正在运行的提取过程会保留其启动时的快照,因此更改将在下次运行时生效。
{
"stages": {
"region": true,
"entities": true,
"scoreboard": true,
"boss_bar": true,
"datapacks": true,
"generated_structures": true,
"storage": true
},
"resources": {
"advancement": true,
"enchantment": true,
"jukebox_song": true,
"trim_material": true,
"trim_pattern": true,
"painting_variant": true,
"instrument": true,
"dialog": true,
"dimension_type": true,
"item_modifier": true,
"loot_table": true,
"predicate": true,
"function": true,
"structure": true
},
"key_reuse": {
"default": true,
"overrides": {}
},
"key_naming": {
"scheme": "structured",
"random_length": 8
},
"nbt_max_depth": 32,
"rebuild_nested_keys": false,
"skipped": {
"command_block_output": true,
"filtered_text": true
},
"skipped_paths": [
"animated_java:function"
],
"builtin_entries": {
"wtem.blank": "",
"wtem.space": " ",
"wtem.0": "0",
"wtem.1": "1",
"wtem.2": "2",
"wtem.3": "3",
"wtem.4": "4",
"wtem.5": "5",
"wtem.6": "6",
"wtem.7": "7",
"wtem.8": "8",
"wtem.9": "9"
},
"language_file": "en_us.json",
"saved_data_text_fields": [
"name",
"custom_name",
"customname",
"title",
"subtitle",
"description",
"text",
"message",
"label",
"display_name",
"displayname",
"lore",
"messages",
"pages",
"lines",
"raw",
"front_text",
"back_text",
"prompt",
"tooltip",
"error_message"
],
"filters": {
"region": [],
"datapack": [],
"storage": [],
"entity": [],
"block_entity": [],
"selection": {
"datapacks": [],
"entities": [],
"block_entities": [],
"storage_files": []
}
},
"outputs": {
"export_region_snbt": false,
"export_schema": false,
"region_snbt_directory": "wtem/regions",
"schema_file": "wtem-schema.json"
},
"ai_translation": {
"enabled": false,
"endpoint": "https://api.deepseek.com",
"api_key": "",
"model": "deepseek-v4-flash",
"target_language": "zh-CN",
"output_file": "zh_cn.json",
"timeout_seconds": 60,
"protocol": "responses",
"translation_prompt": "将提供的 JSON 对象中的值翻译成 {target_language}。仅返回一个具有完全相同键的 JSON 对象。保留 Minecraft 格式化代码、占位符(如 %s 和 %1$s)、转义序列、空白字符和有意的换行符。不要翻译 JSON 键、命令、标识符或格式化令牌。",
"key_naming_prompt": "为提供的文本和 suggested_path 创建一个简洁的语义化 Minecraft 翻译键。仅返回形式为 {\"key\":\"...\"} 的 JSON 对象。仅使用小写 ASCII 字母、数字、下划线和点号。优先使用源类别(item、entity、block、sign、book 或 datapack)作为第一段,并保留语义角色(如 .name、.title 或 .description)作为最后一段。即使可见文本是其他语言,也要将含义翻译成简洁的英文关键词。描述可见文本而非材质 ID:例如,木剑上的“最好的剑”应为 item.the_best_sword.name。切勿包含数字出现索引。"
},
"resource_pack": {
"enabled": true,
"format": "zip",
"name": "resources.zip",
"description": "WTEM translations",
"pack_format": 0
}
}
stages:按提取阶段切换。region 对应区块中的方块实体,entities 对应实体所在的区块,storage 递归读取 data/ 下的所有 *.dat 文件,其余部分包括计分板、Boss 条、世界数据包和世界生成的结构。
resources:按数据包资源类型切换,键名为注册表目录名。生成的文件列出当前版本实际支持的所有类型;未列出的类型视为已启用。
key_reuse:相同文本是否复用已有的翻译键。default 为全局策略,overrides 按键名前缀覆盖该策略,匹配最长前缀者生效。若要在不同位置分别翻译同一文本,请将匹配前缀设为 false,例如 {"datapack.": false}。
key_naming:翻译键的命名方式。见下文。
nbt_max_depth:NBT 提取的递归深度限制,用于防止相互嵌套的项目等耗尽栈空间。每个嵌套项、实体或方块实体消耗一层,超出限制的数据将保持原样不作处理。低于 1 的值被视为默认值。
rebuild_nested_keys:物品上的 block_entity_data 是否从头重新命名自身。默认为 false,因此除复用的情况外,潜影盒内的一把木剑会生成类似 item.shulker_box.1.container.wooden_sword.1.name 的键。设为 true 时,嵌套物品会重新开始其键,并生成类似 item.wooden_sword.1.name 的键。
skipped:可翻译但通常无需翻译的文本。见下文。
skipped_paths:跳过 data/ 下选定目录中的资源;被跳过的资源不会写入配套包。资源定位符格式如 <namespace>:<resource path>:animated_java:function 匹配 data/animated_java/function/**。*:function/generated 匹配所有命名空间中的该目录,而资源路径为 * 则跳过整个命名空间。
builtin_entries:预置到语言文件中的条目。与之匹配的提取文本将复用其键,而不是拥有自己的键。默认预置空字符串、空格和 0~9:这些是始终出现但无翻译值的文本(空白告示牌行、计分板上的数字),预置后各占一行。空对象 {} 不预置任何内容;删除整个选项则保留默认值。
language_file:写入世界目录的语言文件名。仅接受纯文件名;包含路径分隔符或未以 .json 结尾的名称将被忽略。
saved_data_text_fields:在扫描 SavedData 时用于识别可能为文本组件的字段名。默认列表包含 back_text;所选 SavedData 范围内的其他所有字符串均保留并报告为 saved_data_string,而非被猜测为文本。
filters:统一的源过滤器。普通规则包含一个位置,! 表示排除,*/? 为通配符;排除规则优先级最高。区域位置格式为 dimension/chunk/x_z,数据包位置格式为 pack/namespace:path,SavedData 位置格式为 <path below data>.dat/<NBT path>,实体过滤器匹配完整的命名空间类型 ID。
filters.selection:由提取屏幕保存的精确选择结果。数据包和 SavedData 文件从当前世界发现。实体和方块实体的选择来自当前版本的注册表。空列表表示全部选中。取消勾选所有项目会存储内部哨兵值 ["!none"],明确表示“无”。
outputs:启用在世界相对路径 region_snbt_directory 下的每块 SNBT 文件以及一个 schema JSON 文件。
ai_translation:启用后,将完整目录一次性发送至兼容 OpenAI 的 Responses 或 chat-completions 端点。你可以输入 BaseURL 或完整的 /responses 或 /chat/completions URL;使用 BaseURL 时 protocol 用于选择协议。translation_prompt 支持 {target_language} 占位符,key_naming_prompt 控制可选的 AI 语义键命名。
resource_pack:启用后,仅使用配置好的包 name 写入文件夹、ZIP 文件或两者。该包包含 pack.mcmeta 和 assets/wtem/lang/ 目录。
跳过的文本
两个选项默认均为 true。设为 true 时,匹配的文本不会进入语言文件,存档中的原始文本保持不变。
command_block_output:命令方块或命令方块矿车最后一次执行的缓存结果(LastOutput)。
filtered_text:告示牌行和已书写书页的聊天过滤副本(filtered_messages / filtered)。
键命名方案
scheme:
structured(默认):源自提取位置的易读键,例如 entity.zombie.1.name。由于提取是无序的,重复提取不能保证一致性。
hashed:源自提取位置 hash 的键,格式为 wtem.<hash>。对同一存档重复提取会产生相同的键。
random:随机字母,格式为 wtem.<random>。该键与提取位置无关,重复提取不能保证一致性。
ai:将原始文本和建议的源路径发送至配置的兼容 OpenAI 端点。例如,名为 The Best Sword 的木剑可能变为 item.the_best_sword.name。响应必须是有效的点分键。
random_length:random 方案使用的随机字母数量。默认为 8。
开发与构建
仓库默认的激活项目为 26.2.x。在编辑共享源码之前和之后,请使用 Stonecutter 的切换任务为你想要的版本生成源码。
PowerShell 示例:
.\gradlew.bat "Set active project to 1.21.11"
.\gradlew.bat :1.21.11:compileJava :1.21.11:compileTestJava :1.21.11:test :1.21.11:validateAccessWidener
构建并收集一个版本(26.2.x)的发布 JAR:
.\gradlew.bat "Set active project to 26.2.x"
.\gradlew.bat :26.2.x:buildAndCollect
输出结果位于 build/libs/<mod version>/ 中。在提交之前,请运行:
.\gradlew.bat "Reset active project"
这会将共享源码恢复至仓库配置的 26.2.x 状态。
若要一次性构建所有版本:
.\gradlew.bat buildAll
许可证与致谢
本项目采用 CC BY 4.0 许可证。只要保留署名,您可以复制、修改和再分发本作品,包括用于商业用途。
署名要求注明作者姓名、指向本项目的链接、声明使用的许可证(CC BY 4.0,并附上许可证全文或链接),以及说明是否对内容进行了修改。
在再分发该模组或其修改版本时,需附带 LICENSE 文件和 NOTICE。
分发该工具的输出文件同样需要署名。
当您发布语言文件、提取报告或生成的数据包时(无论是单独发布还是包含在世界文件中),请注明这些文件由 WTEM 生成,并提供上述署名信息。
此要求仅适用于生成的文件,不适用于从中提取的世界、翻译内容或其他随同分发的任何材料。
灵感来源于 WorldTranslationExtractor。
WTEM (World Translation Extractor Mod)
English | 中文
WTEM is a client-side Fabric mod that turns hardcoded text in Minecraft worlds, world data packs and world-generated structures into translation keys, and writes the matching i18n entries. It supports several Minecraft versions.
Parts of this mod were created with AI assistance. The AI tools used include gpt-5.6-sol and claude-opus-5.
Supported versions
| Release |
Game versions |
Java |
1.21.1 |
1.21 ~ 1.21.1 |
21 |
1.21.3 |
1.21.2 ~ 1.21.3 |
21 |
1.21.4 |
1.21.4 |
21 |
1.21.5 |
1.21.5 |
21 |
1.21.8 |
1.21.6 ~ 1.21.8 |
21 |
1.21.10 |
1.21.9 ~ 1.21.10 |
21 |
1.21.11 |
1.21.11 |
21 |
26.1.x |
26.1 ~ 26.1.2 |
25 |
26.2.x |
26.2 |
25 |
Usage
- Put the mod file for your Minecraft version into the client's
mods directory.
- Start the game, select the target world in the singleplayer world list and open its "Edit" page.
- Click the "Extract" button.
- Create a backup on the backup confirmation page. Always backing up is strongly recommended; extraction modifies world data in place.
- Wait for extraction to finish. The screen shows chunk progress and a warning count; the game log has the details.
Extraction can be cancelled once it has started. Chunks, SavedData and structures already written before the cancellation or before an error are not rolled back, so back up first.
What gets extracted
Save data:
- Block entity text in chunks, such as container names, signs and command block output.
- Text in entities and their nested data: passengers, equipment, inventories, villager trades.
- Scoreboard team, objective and score display names.
- Custom boss bar names.
- NBT structures actually present in the world's
generated/<namespace>/structure(s).
- Every non-vanilla compressed
*.dat SavedData file below the world's data/ directory, including nested custom files, with conservative field detection and per-file/path filtering. Every NBT string in the selected scope records a saved_data_string warning; only strings identified as text components are extracted. The recognized field names are configurable through saved_data_text_fields (which includes back_text by default).
Datapacks:
- Known text fields in advancements, enchantments, jukebox songs, armor trims, paintings, instruments, dialogs and dimension types (for example
attributes.minecraft:gameplay/bed_rule.error_message).
- Translatable text components in item modifiers, loot tables and predicates.
- Entity, block entity and item text in NBT structures.
- Text component arguments in functions, entity text in the
nbt argument of summon, and arguments that parse as an item or a block entity, such as give's item components and the block entity NBT of setblock and fill.
Output
A finished extraction may produce:
<world>/en_us.json: the mapping from translation keys to the original text.
<world>/en_us.csv: the extraction report, recording where each piece of text was found. See the next section.
<world>/datapacks/<original pack>_<short hash>_wtem/: an override data pack paired with the original world data pack.
- The default client resource pack,
resources.zip, under <world>/ before 26.1 and under <world>/resourcepacks/ in 26.1 and newer.
- Modified block entities, entities, scoreboard,
bossbar and structures, with hardcoded text components replaced by translate components.
WTEM will not modify the original world datapack.
The generated new data package will only save the resources that have actually changed and pack.mcmeta.
Before re-entering the world, confirm in the datapack configuration that the overlay pack is enabled and above the original pack.
Extraction report
Extraction also exports a report, named after the language file with a .csv suffix.
Its columns:
| Column |
Contents |
key |
The generated translation key. |
text |
The original text that was replaced. |
source |
The extraction stage, i.e. the name used in the config's stages, for example region or datapacks. |
location |
Where the data lives: dimension and chunk, data pack and resource ID, or structure file. |
subject |
The chain of containing objects, outermost first, joined by >, for example minecraft:chest (12, 64, -30) > minecraft:shulker_box. |
reused |
Whether this occurrence reused an existing key. true means it added no language file entry, and that editing the key affects more than one place. |
replaced |
Whether the original world/data-pack value was replaced with a translate component. false identifies catalog-only text instead of a replaced one. |
A key that appears in several places has one language file entry but one report row per occurrence, so the report usually has more rows than the language file has entries. If extraction is cancelled or fails partway, the part already written is exported along with the language file.
Warning types
Warnings are non-fatal diagnostics. Each warning includes its type and the source file, resource ID, command, or NBT path that caused it.
The warnings below identify cases that need review or could not be rewritten safely.
| Type |
Meaning |
region_snbt |
A per-region SNBT export could not be written. |
saved_data |
A SavedData file could not be read, decompressed, parsed, or selected. |
saved_data_string |
A plain string was found in the selected SavedData scope. It remains unchanged unless it is in a configured text field. |
datapack |
A data-pack resource could not be read or processed. |
datapack_staging |
A generated override data pack could not be staged or published. |
function_index |
The function call index could not be built for a data pack. |
function_parse |
A function command could not be parsed by Minecraft's command parser. |
function_command |
A parsed command could not be processed. |
function_reparse |
A rewritten command did not pass the validation reparse. |
function_component_rewrite |
A text component or structured argument in a function could not be rewritten safely. |
function_selector_name |
A selector name that looks like a text-bearing argument could not be resolved. |
function_storage_string |
A literal string was written directly into command storage by data modify storage ... set value. |
function_macro_binding |
A macro caller/storage binding was missing, ambiguous, or not statically resolvable. |
function_macro_restore |
A materialized macro command could not be restored and validated for its callers. |
writable_book |
A writable-book writable_book_content.pages[*].raw string was cataloged but cannot be replaced by a component (replaced=false). |
written_book_string |
A written-book plain string such as author remains unchanged. |
generated_structure |
A world-generated structure could not be read or rewritten. |
language |
The primary language catalog could not be written. |
manifest |
The CSV extraction report could not be written. |
schema |
The optional extraction schema could not be written. |
resource_pack |
The optional client resource pack could not be written. |
ai_key_naming |
AI semantic key naming failed or returned an invalid key; structured naming is used as a fallback. |
ai_translation |
The AI translation request or response failed; the normal catalog is retained. |
close |
An extraction resource could not be closed cleanly after the run. |
Configuration
The first launch writes a default config to config/wtem.json, with every option spelled out at its default value so it can be edited directly.
Every option is optional: deleting one or leaving it out keeps the default behavior.
You can also access the YACL configuration interface by clicking the Configuration button in the extraction screen.
The Select sources button on the extraction screen opens a YACL screen for datapacks, SavedData files, and entity/block entity types.
The Configuration button is reserved for the other extraction settings.
Editing wtem.json externally is hot-reloaded automatically.
A running extraction keeps its startup snapshot, so changes apply to the next run.
{
"stages": {
"region": true,
"entities": true,
"scoreboard": true,
"boss_bar": true,
"datapacks": true,
"generated_structures": true,
"storage": true
},
"resources": {
"advancement": true,
"enchantment": true,
"jukebox_song": true,
"trim_material": true,
"trim_pattern": true,
"painting_variant": true,
"instrument": true,
"dialog": true,
"dimension_type": true,
"item_modifier": true,
"loot_table": true,
"predicate": true,
"function": true,
"structure": true
},
"key_reuse": {
"default": true,
"overrides": {}
},
"key_naming": {
"scheme": "structured",
"random_length": 8
},
"nbt_max_depth": 32,
"rebuild_nested_keys": false,
"skipped": {
"command_block_output": true,
"filtered_text": true
},
"skipped_paths": [
"animated_java:function"
],
"builtin_entries": {
"wtem.blank": "",
"wtem.space": " ",
"wtem.0": "0",
"wtem.1": "1",
"wtem.2": "2",
"wtem.3": "3",
"wtem.4": "4",
"wtem.5": "5",
"wtem.6": "6",
"wtem.7": "7",
"wtem.8": "8",
"wtem.9": "9"
},
"language_file": "en_us.json",
"saved_data_text_fields": [
"name",
"custom_name",
"customname",
"title",
"subtitle",
"description",
"text",
"message",
"label",
"display_name",
"displayname",
"lore",
"messages",
"pages",
"lines",
"raw",
"front_text",
"back_text",
"prompt",
"tooltip",
"error_message"
],
"filters": {
"region": [],
"datapack": [],
"storage": [],
"entity": [],
"block_entity": [],
"selection": {
"datapacks": [],
"entities": [],
"block_entities": [],
"storage_files": []
}
},
"outputs": {
"export_region_snbt": false,
"export_schema": false,
"region_snbt_directory": "wtem/regions",
"schema_file": "wtem-schema.json"
},
"ai_translation": {
"enabled": false,
"endpoint": "https://api.deepseek.com",
"api_key": "",
"model": "deepseek-v4-flash",
"target_language": "zh-CN",
"output_file": "zh_cn.json",
"timeout_seconds": 60,
"protocol": "responses",
"translation_prompt": "Translate the values of the supplied JSON object into {target_language}. Return only one JSON object with exactly the same keys. Preserve Minecraft formatting codes, placeholders such as %s and %1$s, escape sequences, whitespace, and intentional line breaks. Do not translate JSON keys, commands, identifiers, or formatting tokens.",
"key_naming_prompt": "Create one concise semantic Minecraft translation key for the supplied text and suggested_path. Return only a JSON object in the form {\"key\":\"...\"}. Use lowercase ASCII letters, digits, underscores, and dots only. Prefer the source category (item, entity, block, sign, book, or datapack) as the first segment and preserve the semantic role such as .name, .title, or .description as the last segment. Translate the meaning into concise English key words even when the visible text is in another language. Describe the visible text rather than the material id: for example, The Best Sword on a wooden sword should be item.the_best_sword.name. Never include numeric occurrence indexes."
},
"resource_pack": {
"enabled": true,
"format": "zip",
"name": "resources.zip",
"description": "WTEM translations",
"pack_format": 0
}
}
stages: switches per extraction stage. region is block entities in chunks, entities is entity chunks, storage recursively reads every *.dat below data/, and the rest are the scoreboard, boss bars, world data packs and world-generated structures.
resources: switches per data pack resource type, keyed by registry directory name. The generated file lists every type the current version actually supports; a type that is not listed counts as enabled.
key_reuse: whether identical text reuses an existing translation key. default is the global policy and overrides overrides it by key prefix, with the longest matching prefix winning. To translate the same text separately in different places, set the matching prefix to false, for example {"datapack.": false}.
key_naming: how translation keys are named. See below.
nbt_max_depth: the recursion limit for NBT extraction, which keeps mutually nested items and the like from exhausting the stack. Each nested item, entity or block entity costs one level, and data past the limit is left as it is. A value below 1 is treated as the default.
rebuild_nested_keys: whether block_entity_data on an item names itself from scratch. It is false by default, so, reuse aside, a wooden sword inside a shulker box gets a key such as item.shulker_box.1.container.wooden_sword.1.name. With true, nested items restart their key and produce a key such as item.wooden_sword.1.name.
skipped: text that can be translated but usually does not need to be. See below.
skipped_paths: skips resources below selected directories under data/; skipped resources are not written to the companion pack. The resource-location form is like <namespace>:<resource path>: animated_java:function matches data/animated_java/function/**. *:function/generated matches that directory in every namespace, and a resource path of * skips a whole namespace.
builtin_entries: entries seeded into the language file. Extracted text that matches one of them reuses its key instead of taking a key of its own. The defaults seed the empty string, a space and 0~9: text with no translation value that nonetheless shows up constantly (blank sign lines, numbers on a scoreboard), which after seeding takes one line each. An empty object {} seeds nothing; deleting the whole option keeps the defaults.
language_file: the name of the language file written into the world directory. Only a plain file name is accepted; a name containing a path separator or not ending in .json is ignored.
saved_data_text_fields: field names used to identify likely text components while scanning SavedData. The default list includes back_text; every other string in the selected SavedData scope is retained and reported as saved_data_string instead of being guessed as text.
filters: unified source filters. A normal rule includes a location, ! excludes it, and */? are wildcards; exclusions always win. Region locations are dimension/chunk/x_z, data-pack locations are pack/namespace:path, SavedData locations are <path below data>.dat/<NBT path>, and the entity filters match full namespaced type IDs.
filters.selection: exact choices saved by the extraction screen. Data packs and SavedData files are discovered from the current world. Entity and block-entity choices come from the current version's registries. An empty list means all current. Unchecking every item stores the internal sentinel ["!none"], which explicitly means none.
outputs: enables per-chunk SNBT files under the world-relative region_snbt_directory and a schema JSON file.
ai_translation: when enabled, sends the complete catalog in one request to an OpenAI-compatible Responses or chat-completions endpoint. You may enter either a BaseURL or a complete /responses or /chat/completions URL; protocol selects the protocol when a BaseURL is used. translation_prompt supports the {target_language} placeholder, and key_naming_prompt controls optional AI semantic key naming.
resource_pack: when enabled, writes a folder, ZIP, or both using only the configured pack name. The pack contains pack.mcmeta and assets/wtem/lang/ catalogs.
Skipped text
Both options default to true. Set to true, the matching text stays out of the language file and the original text in the save is left alone.
command_block_output: the cached result of the last execution of a command block or command block minecart (LastOutput).
filtered_text: the chat-filtered copy of sign lines and written book pages (filtered_messages / filtered).
Key naming schemes
scheme:
structured (default): readable keys derived from the extraction site, for example entity.zombie.1.name. Because extraction is unordered, repeated extraction is not guaranteed to be consistent.
hashed: keys derived from a hash of the extraction site, of the form wtem.<hash>. Repeated extraction of the same save produces the same keys.
random: random letters, of the form wtem.<random>. The key is unrelated to the extraction site, and repeated extraction is not guaranteed to be consistent.
ai: sends the original text and suggested source path to the configured OpenAI-compatible endpoint. For example, a wooden sword named The Best Sword may become item.the_best_sword.name. Responses must be valid dotted keys.
random_length: how many random letters the random scheme uses. 8 by default.
Development and building
The repository's default active project is 26.2.x. Before and after editing shared sources, use Stonecutter's switch tasks to generate the sources for the version you want.
PowerShell example:
.\gradlew.bat "Set active project to 1.21.11"
.\gradlew.bat :1.21.11:compileJava :1.21.11:compileTestJava :1.21.11:test :1.21.11:validateAccessWidener
Build and collect the release JAR for one version (26.2.x):
.\gradlew.bat "Set active project to 26.2.x"
.\gradlew.bat :26.2.x:buildAndCollect
The output lands in build/libs/<mod version>/. Before committing, run:
.\gradlew.bat "Reset active project"
which restores the shared sources to the 26.2.x state the repository is configured for.
To build every version in one go:
.\gradlew.bat buildAll
License and credits
This project uses CC BY 4.0. You may copy, modify and redistribute it, including commercially, as long as you keep the attribution.
Attribution means naming the author, pointing at this project, stating the license (CC BY 4.0, with its text or a link), and saying whether you changed anything.
When redistributing the mod or a modified version, shipping LICENSE and NOTICE.
Distributing the tool's output requires attribution too.
When you publish the language file, the extraction report or the generated data packs, on their own or inside a world, state that those files were produced by WTEM and give the attribution above.
This covers the generated files only, not the world extracted from, translations, or anything else you distribute alongside them.
Inspired by WorldTranslationExtractor.
评论 0
登录后参与评分
还没有评论,来抢沙发吧