Skip to content

google-translate-api golang translate 谷歌翻译 翻译 接口

License

Notifications You must be signed in to change notification settings

jinzhongmin/gtra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gtra 谷歌翻译api

golang实现的谷歌翻译api

参考并使用了 https://github.com/matheuss/google-translate-api 的部分代码

bug:有时会出现403错误网页

安装

go get -u -v github.com/jinzhongmin/gtra

例子

package main

import (
	"fmt"

	"github.com/jinzhongmin/gtra"
	"github.com/jinzhongmin/gtra/lang"
)

func main() {
	t := gtra.NewTranslater()
	fmt.Println(t.Translate("hello"))
	fmt.Println(gtra.Translate("world", lang.ZHCN))

	fmt.Println(t.Vector(lang.ZHCN, lang.EN).Translate("你好世界"))
	fmt.Println(t.To(lang.JA).Translate("你好世界"))

	_, j := t.Vector(lang.EN, lang.ZHCN).Dt("like", "t", "at")
	fmt.Println(j.String())
}

api

api

func (t *Translater) Dt(src string, dt ...string) (error, gjson.Result)

dt参数请参考 &

License

MIT © jinzhongmin

About

google-translate-api golang translate 谷歌翻译 翻译 接口

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages