Coloured_glaze
本帖最后由 Coloured_glaze 于 2019-9-29 19:26 编辑

列如YAML文件格式是这样的 汉化
  1. Messages:
  2.   timeleftofcombat: AntiCombatLog You have %time% seconds left of Combat!
  3.   notincombat: AntiCombatLog You are not in Combat!
  4.   nowincombat: AntiCombatLog You are now in Combat, DONT LOGOUT!! To check your remaining time left in Combat type /ct
  5.   outofcombat: AntiCombatLog You are now out of Combat, you may logout now!
  6.   canttpincombat: AntiCombatLog &cYou can't teleport in Combat.
  7.   oncombatlog: AntiCombatLog %player% &clogged out in Combat!
  8.   canttypecommand: AntiCombatLog You can't type that command in Combat.
  9. combattime: 25
  10. disableFly: true
  11. disableCreative: true
  12. canTPincombat: false
  13. blocked-cmds: []
复制代码
屏蔽 :前面的所有字符并获取 :后面的所有字符
然后忽略true false [] 等等其他的

获取并提交处理代码
  1. package io.github.vanishtime.mcspautotrans;

  2. import io.github.vanishtime.mcspautotrans.engine.EngineFactory;
  3. import io.github.vanishtime.mcspautotrans.engine.IEngine;
  4. import io.github.vanishtime.mcspautotrans.engine.Language;

  5. public class MCSPAutoTrans {

  6.     public static void main(String[] args) {
  7.         IEngine engine = EngineFactory.getEngine("google");
  8.         System.out.println(engine.translate("Hello! World!", Language.AUTO, Language.ZHCN));
  9.     }

  10. }
复制代码
想做一个自动汉化

云闪
snakeyaml了解一下

直接split取第一个冒号也行_(:з」∠)_大概

mc能吃吗
本帖最后由 mc能吃吗 于 2019-9-29 21:48 编辑

getConfig 得到一整个配置文件的集合map
然后 getKey 还是 getAllkey 得到所有键值的集合,就比如有
abc:
    efg:
就可以得到abc与efg
之后?我也不知道啊。。。或许删掉。。。?


getConfig可以直接获取一个比如[key:var]的map...
直接把第一个参数删掉?23333

但是我觉得还是1L的方法实用 直接删冒号岂不是更好233


Coloured_glaze
mc能吃吗 发表于 2019-9-29 21:47
getConfig 得到一整个配置文件的集合map
然后 getKey 还是 getAllkey 得到所有键值的集合,就比如有
abc ...

我为什么不直接选择忽略冒号前的字符串 获取后面 然后汉化 在替换

第一页 上一页 下一页 最后一页