Esempio n. 1
0
func main() {

	cfg := new(tool.Config)
	tool.LoadConfig(cfg, "./config.json")

	d := dict.NewDict()
	for _, v := range cfg.DictDir.CSVDir {

		dict.LoadCSV(d, v)
	}

	for _, v := range cfg.DictDir.XMLDir {

		dict.LoadXML(d, v)
	}

	for _, v := range cfg.DictDir.EXDir {

		dict.LoadEx(d, v)
	}

	lang := dict.NewDict()
	dict.LoadXML(lang, cfg.SrcDir)

	arr := make(map[string]int)
	m := lang.GetData()
	for k, _ := range m {

		item := d.GetItem(k)
		if item == nil {
			arr[k] = 0
			continue
		}

		item.Key = m[k].Key
		m[k] = item
	}
	trans.SaveXML(lang, cfg.DstDir+"zh_tw.xml")

	trans.SaveNilToCSV(arr, cfg.DstDir+"../lang.left")
	// r := new(Rout)
	// r.dict = d
	// r.cfg = cfg

	// tool.RoutineLoadDir(r, cfg.SrcDir)

	// trans.SaveXMLKeyToCSV(d, cfg.DstDir + "../lang.left")
}
Esempio n. 2
0
func main() {

	lastTime := time.Now().UnixNano()

	cfg := new(tool.Config)
	tool.LoadConfig(cfg, "./config.json")

	ccbD := dict.NewDict()
	for _, v := range cfg.DictDir.CSVDir {

		dict.LoadCSV(ccbD, v)
	}

	for _, v := range cfg.DictDir.XMLDir {

		dict.LoadXML(ccbD, v)
	}

	for _, v := range cfg.DictDir.EXDir {

		dict.LoadEx(ccbD, v)
	}

	fmt.Printf("++++%v\n", time.Now().UnixNano()-lastTime)

	// t := new(trans.CCBTrans)
	t := trans.NewCCBTrans()
	trans.Format(t, ccbD, cfg)

	trans.SaveNilToCSV(t.GetNilArr(cfg.DIgnore.Array), cfg.DstDir+"../ccb.left")
}
Esempio n. 3
0
func main() {

	lastTime := time.Now().UnixNano()

	cfg := new(tool.Config)
	tool.LoadConfig(cfg, "./config.json")

	d := dict.NewDict()
	for _, v := range cfg.DictDir.CSVDir {

		dict.LoadCSV(d, v)
	}

	for _, v := range cfg.DictDir.XMLDir {

		dict.LoadXML(d, v)
	}

	for _, v := range cfg.DictDir.EXDir {

		dict.LoadEx(d, v)
	}

	switch cfg.Type {
	case "ccb":
		LoadCCB(cfg, d)
	case "config":
		LoadConfig(cfg, d)
	case "lang":
		LoadLang(cfg, d)
	case "Class":
		LoadClass(cfg, d)
	}

	// trans.SaveNilToCSV(r.NilArr, cfg.DstDir + "../ccb.left")
	fmt.Printf("++++%v\n", time.Now().UnixNano()-lastTime)
}