mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-19 13:35:25 +00:00
Commit from m3o/m3o action
This commit is contained in:
21
examples/translate/text/translateString/main.go
Executable file
21
examples/translate/text/translateString/main.go
Executable file
@@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"go.m3o.com/translate"
|
||||
)
|
||||
|
||||
// TextRequest is the basic edition request
|
||||
func main() {
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user