mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-12 10:55:11 +00:00
39 lines
620 B
Markdown
Executable File
39 lines
620 B
Markdown
Executable File
# Translate
|
|
|
|
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/translate/api](https://m3o.com/translate/api).
|
|
|
|
Endpoints:
|
|
|
|
## Text
|
|
|
|
Basic text translation
|
|
|
|
|
|
[https://m3o.com/translate/api#Text](https://m3o.com/translate/api#Text)
|
|
|
|
```go
|
|
package example
|
|
|
|
import(
|
|
"fmt"
|
|
"os"
|
|
|
|
"go.m3o.com/translate"
|
|
)
|
|
|
|
// Basic text translation
|
|
func TranslateText() {
|
|
translateService := translate.NewTranslateService(os.Getenv("M3O_API_TOKEN"))
|
|
rsp, err := translateService.Text(&translate.TextRequest{
|
|
Content: "hello",
|
|
Format: "text",
|
|
Model: "nmt",
|
|
Source: "en",
|
|
Target: "fr",
|
|
|
|
})
|
|
fmt.Println(rsp, err)
|
|
|
|
}
|
|
```
|