The "mstranslator" is a Micrsoft Translator Service client which written by Golang.
Microsoft Translator is a cloud based automatic translation service. (Refer here for more detail).
Here is another site for Microsoft Translator API.
go get github.com/kkdai/mstranslator
Sign-up for Microsoft Translator API (see here for more detail) and get your developer credentials. Use the client ID and secret to instantiate a translator as shown below.
package main
import (
"fmt"
"log"
ms "github.com/kkdai/mstranslator"
)
func main() {
msClient := ms.NewClient("YourClientID", "YourClientSecret")
//Translate "Hello World" from English to France.
translation, err := msClient.Translate("Hello World!", "en", "de")
if err != nil {
log.Panicf("Error : %s", err.Error())
}
fmt.Println(translation) //Hallo Welt!
}
Check example for more detail.
- Detect
- DetectArray
- GetLanguageNames
- GetLanguagesForTranslate
- GetLanguagesForSpeak
- GetTranslations
- Translate
- TransformText
- Speak
Please open up an issue on GitHub before you put a lot efforts on pull request.
The code submitting to PR must be filtered with gofmt
This project is inspired by https://github.com/st3v/translator.
It is one of my project 52.
This package is licensed under MIT license. See LICENSE for details.