/gtranslate

Google translate API for unlimited and free translations, gtranslate generates the necessary token to use the Google Translate API for free

Primary LanguageGoMIT LicenseMIT

gtranslate build

Google Translate API for unlimited and free translations 📢. This project was inspired by google-translate-api and google-translate-token.

Install

go get github.com/bregydoc/gtranslate

Use

gtranslate.Translate("I'm alive", language.English, language.Spanish)
gtranslate.TranslateWithParams("I'm alive", gtranslate.TranslateWithParams{From: "en", To: "es"})

Example

package main

import (
	"fmt"

	"github.com/bregydoc/gtranslate"
)

func main() {
	text := "Hello World"
	translated, err := gtranslate.TranslateWithParams(
		text,
		gtranslate.TranslationParams{
			From: "en",
			To:   "ja",
		},
	)
	if err != nil {
		panic(err)
	}

	fmt.Printf("en: %s | ja: %s \n", text, translated)
	// en: Hello World | ja: こんにちは世界
}