mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-22 14:55:16 +00:00
Commit from m3o/m3o action
This commit is contained in:
38
examples/translate/README.md
Executable file
38
examples/translate/README.md
Executable file
@@ -0,0 +1,38 @@
|
||||
# Translate
|
||||
|
||||
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Translate/api](https://m3o.com/Translate/api).
|
||||
|
||||
Endpoints:
|
||||
|
||||
## Text
|
||||
|
||||
TextRequest is the basic edition request
|
||||
|
||||
|
||||
[https://m3o.com/translate/api#Text](https://m3o.com/translate/api#Text)
|
||||
|
||||
```go
|
||||
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)
|
||||
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user