deepL-GO는 DeepL API를 사용하여 번역 기능을 제공하는 Go 언어 라이브러리입니다.
deepL-GO는 DeepL의 번역 기능을 간편하게 사용할 수 있도록 도와주는 라이브러리입니다. 이 라이브러리를 사용하면 다양한 언어의 텍스트를 간단하게 번역할 수 있습니다.
Go Modules를 사용하여 간편하게 설치할 수 있습니다.
go get github.com/mohan12311/deepL-GO
아래는 deepL-GO 라이브러리를 사용하는 간단한 예제입니다.
package main
import (
"fmt"
"log"
"github.com/mohan12311/deepL-GO/deepl"
)
func main() {
apiKey := "YOUR_DEEPL_API_KEY"
client := deepl.NewClient(apiKey)
translationRequest := deepl.NewTranslationRequest(
[]string{"Hello world"},
"DE",
// optional choice
deepl.WithSourceLang("EN"),
deepl.WithFormality("more"),
)
translatedText, err := client.Translate(translationRequest)
if err != nil {
log.Fatalf("Failed to translate text: %v", err)
}
fmt.Println("Translated Text:", translatedText)
}