Categorygithub.com/Conight/go-googletrans
modulepackage
0.2.4
Repository: https://github.com/conight/go-googletrans.git
Documentation: pkg.go.dev

# README

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.

# Functions

No description provided by the author
No description provided by the author

# Variables

No description provided by the author

# Structs

Config basic config.
Translated result object.
No description provided by the author