Files
m3o-go/examples/translate/README.md
2021-12-10 10:19:18 +00:00

677 B
Executable File

Translate

An m3o.com API. For example usage see m3o.com/Translate/api.

Endpoints:

Text

TextRequest is the basic edition request

https://m3o.com/translate/api#Text

package example

import(
	"fmt"
	"os"

	"go.m3o.com/translate"
)

// TextRequest is the basic edition request
func TranslateString() {
	translateService := translate.NewTranslateService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := translateService.Text(&translate.TextRequest{
		Contents: []string{"pen", "pencil"},
Format: "text",
Model: "nmt",
Source: "en",
Target: "zh",

	})
	fmt.Println(rsp, err)
	
}