Skip to content

(Unofficial) Googletrans: Free and Unlimited Google translate API for Golang. Translates totally free of charge.

License

Notifications You must be signed in to change notification settings

Conight/go-googletrans

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-googletrans

Googletrans

Sourcegraph License: MIT

This is Golang version of py-googletrans.

Googletrans is a free and unlimited Golang library that implemented Google Translate API. This uses the Google Translate Ajax API from Chrome extensions to make calls to such methods as detect and translate.

Download from Github

GO111MODULE=on go get github.com/Conight/go-googletrans

Quick Start Example

Simple translate

package main

import (
	"fmt"
	"github.com/Conight/go-googletrans"
)

func main() {
	t := translator.New()
	result, err := t.Translate("你好,世界!", "auto", "en")
	if err != nil {
		panic(err)
	}
	fmt.Println(result.Text)
}

Using proxy

c := translator.Config{
    Proxy: "http://PROXY_HOST:PROXY_PORT",
}
t := translate.New(c)

Using custom service urls or user agent

c := translator.Config{
    UserAgent: []string{"Custom Agent"},
    ServiceUrls: []string{"translate.google.com.hk"},
}
t := translate.New(c)

See Examples for more examples.

Special thanks

License

This SDK is distributed under the The MIT License, see LICENSE for more information.

About

(Unofficial) Googletrans: Free and Unlimited Google translate API for Golang. Translates totally free of charge.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages