package utils

import (
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/config"
	"github.com/astaxie/beego/logs"
	"log"
	"os"
	"path/filepath"
	_ "strings"
)

var (
	zhConf, _ = config.NewConfig("ini", GetCurrentPath()+"/i18n/zh.ini")
	enConf, _ = config.NewConfig("ini", GetCurrentPath()+"/i18n/en.ini")

	InfoLogger  = logs.GetLogger("info")
	ErrorLogger = logs.GetLogger("error")
)

// 国际化
func GetI18nLang(lang string, name string) string {
	if lang == "en" {
		return enConf.String(name)
	}
	return zhConf.String(name)
}

func GetCurrentPath() string {
	dir, err := filepath.Abs(filepath.Dir(os.Args[0]))
	if err != nil {
		beego.Debug(err)
	}
	log.Println(dir)
	//return strings.Replace(dir, "\\", "/", -1)
	return "E:\\go_workspace\\src\\k8s-console"
	//return dir
}
