本帖最后由 Coloured_glaze 于 2019-9-29 19:26 编辑
列如YAML文件格式是这样的 汉化
复制代码屏蔽 :前面的所有字符并获取 :后面的所有字符
然后忽略true false [] 等等其他的
获取并提交处理代码
复制代码想做一个自动汉化
列如YAML文件格式是这样的 汉化
- Messages:
- timeleftofcombat: AntiCombatLog You have %time% seconds left of Combat!
- notincombat: AntiCombatLog You are not in Combat!
- nowincombat: AntiCombatLog You are now in Combat, DONT LOGOUT!! To check your remaining time left in Combat type /ct
- outofcombat: AntiCombatLog You are now out of Combat, you may logout now!
- canttpincombat: AntiCombatLog &cYou can't teleport in Combat.
- oncombatlog: AntiCombatLog %player% &clogged out in Combat!
- canttypecommand: AntiCombatLog You can't type that command in Combat.
- combattime: 25
- disableFly: true
- disableCreative: true
- canTPincombat: false
- blocked-cmds: []
然后忽略true false [] 等等其他的
获取并提交处理代码
- package io.github.vanishtime.mcspautotrans;
- import io.github.vanishtime.mcspautotrans.engine.EngineFactory;
- import io.github.vanishtime.mcspautotrans.engine.IEngine;
- import io.github.vanishtime.mcspautotrans.engine.Language;
- public class MCSPAutoTrans {
- public static void main(String[] args) {
- IEngine engine = EngineFactory.getEngine("google");
- System.out.println(engine.translate("Hello! World!", Language.AUTO, Language.ZHCN));
- }
- }
snakeyaml了解一下
直接split取第一个冒号也行_(:з」∠)_大概
直接split取第一个冒号也行_(:з」∠)_大概
本帖最后由 mc能吃吗 于 2019-9-29 21:48 编辑
getConfig 得到一整个配置文件的集合map
然后 getKey 还是 getAllkey 得到所有键值的集合,就比如有
abc:
efg:
就可以得到abc与efg
之后?我也不知道啊。。。或许删掉。。。?
getConfig可以直接获取一个比如[key:var]的map...
直接把第一个参数删掉?23333
但是我觉得还是1L的方法实用 直接删冒号岂不是更好233
getConfig 得到一整个配置文件的集合map
abc:
efg:
就可以得到abc与efg
之后?我也不知道啊。。。或许删掉。。。?
getConfig可以直接获取一个比如[key:var]的map...
直接把第一个参数删掉?23333
但是我觉得还是1L的方法实用 直接删冒号岂不是更好233
mc能吃吗 发表于 2019-9-29 21:47
getConfig 得到一整个配置文件的集合map
然后 getKey 还是 getAllkey 得到所有键值的集合,就比如有
abc ...
我为什么不直接选择忽略冒号前的字符串 获取后面 然后汉化 在替换