FTBquest任务自动机翻
这是我自用的一个简单的python小脚本,用来翻译ftbquests中的任务文件。本质上是摘取snbt中指定内容后送翻译API后写回。机翻虽然翻译质量一般但是任务的机翻文字后面保留了原文,就算有问题也可以对照着看明白,对于有些整合包无人汉化或者汉化成果为老版本没法用的情况下,自己拿来游玩国外整合包还是蛮方便的。
后面我可能会考虑将这一脚本以web服务形式免费提供给大家,具体流程大致为:选择翻译的api(免费或付费,付费api需自己提供密钥)->上传ftbquest压缩包->接收汉化完的ftbquest压缩包
希望大家不要把机翻出来的任务文件未经修整直接发布,粗劣机翻会影响他人游玩体验。
基础原理
想必接触过任务汉化的应该都知道ftbquest中任务文件大多存储在.minecraft\config\ftbquests文件夹中。
其中的chapters以及rewardtables文件夹下分别存储着子章节任务以及所有奖励表,除此之外也可能有章节集合chapter_groups.snbt以及任务整体信息data.snbt等文本,但不论文件类型如何他们所需翻译的区域是相同的即title(主标题)、subtitle(副标题)、description(简介)、text(正文)这几个可能存在的区域,我们只需要专注于这些内容摘出其中文本送给api翻译即可。
一个常规的chapter下子任务snbt内容 { title: "A Real Improvement to your ME Network", x: 1.0d, y: -1.0d, description: "Let's use P2P Tunnel's!", text: [ "It is §chard§f to §2explain in details§f about a §6P2P Setup§f here, but here's a rough explanation:", "", "- With §62 P2P Tunnel's§f, you can link them using a §dMemory Card§f.", "", "- §9One§f of them §8§o(the first you've clicked)§r§f will be the §9Input§f and the §bother§f one will be the §bOutput§f.", "", "- With §5Between§f these §62 P2P's§f there §dwill be a Subnetwork formed§f, meaning, that you'll need to §eprovide it with Power§f.", "§8§o(You could use an Energy Acceptor or a Quartz Fiber to route Energy from your Main Network)§r§f", "", "- This could be §aREALLY§f good to get §d32 Channels§f from your §3Main AE Network§f from §9point A§f to §epoint B§f across a §dsubnetwork§f.", "", "- §aA Good AE2 Engineer§f really §3takes advantage of this feature§f, as once you've learn how to use it, §c§nChannel's will never be a problem anymore§r§f.", "", "§8§o~ Please, for more Information, check the next quest for a link to the Official Wiki.§r§f" ], dependencies: [ "e54b21e4" ], min_width: 300, tasks: [{ uid: "692d8d75", type: "item", items: [{ item: "appliedenergistics2:part 1 460" }], count: 2L }, { uid: "fdaeca22", type: "item", items: [{ id: "appliedenergistics2:memory_card", tag: {} }], ignore_damage: true, ignore_nbt: 1b }], rewards: [{ uid: "da1219ea", type: "ftbmoney:money", ftb_money: 50L }] }
代码
详见https://github.com/XDawned/FTBQLocalizationTools
使用说明
- 复制粘贴
config_example.py并将新文件重命名为config.py,配置APPID和APPKEY - 将ftbquest文件夹放到程序同级目录下运行程序
下面直接运行脚本即可,你可以在编译器中观察到翻译的走向,翻译结果将放在ftbquests-trans文件夹下.
成果样例
下面是我截取的使用脚本翻译出的ATM8任务中的一节截图,可以看到保留了彩色格式以及原文紧跟在汉语后展示。


浙公网安备 33010602011771号