예제 #1
0
func MsTrans(clientID, clientSecret, in string) (out string) {
	t := microsoft.NewTranslator(clientID, clientSecret)
	from, err := MsDetect(clientID, clientSecret, in)
	if err != nil {
		return "警报!弹药系统过载!请放宽后重试"
	}
	switch from {
	case "zh-CHS", "zh-CHT":
		out, err = t.Translate(in, from, "en")
	default:
		out, err = t.Translate(in, from, "zh-CHS")
	}
	if err != nil {
		return "可怜的群组娘被母舰放逐了X﹏X"
	}
	return out
}
예제 #2
0
파일: trans.go 프로젝트: Megadotzip/Jqs7Bot
func (m *MsTrans) New() {
	m.t = microsoft.NewTranslator(
		conf.GetItem("msTransId"),
		conf.GetItem("msTransSecret"))
}
예제 #3
0
func MsDetect(clientID, clientSecret, in string) (string, error) {
	t := microsoft.NewTranslator(clientID, clientSecret)
	return t.Detect(in)
}
예제 #4
0
func (m *MsTrans) New() {
	m.t = microsoft.NewTranslator(msID, msSecret)
}