Documentation ¶
Index ¶
- Variables
- func SimpleRequest(client *http.Client, method, url string, requestBody, responseBody interface{}) (*http.Response, error)
- type BingTranslator
- type BingTranslatorOptions
- type LibreOptions
- type LibreTranslateInput
- type MockTranlator
- type SupportedLanguage
- type Translator
- type TranslatorOptions
- type TranslatorProvider
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultEndpoint = "https://api.cognitive.microsofttranslator.com/"
)
Functions ¶
Types ¶
type BingTranslator ¶
type BingTranslator struct {
BingTranslatorOptions
}
func NewBingTranslator ¶
func NewBingTranslator(options BingTranslatorOptions) (BingTranslator, error)
func (*BingTranslator) Translate ¶
func (bt *BingTranslator) Translate(text, from, to string) (string, error)
Based on https://docs.microsoft.com/en-us/azure/cognitive-services/translator/reference/v3-0-translate
type BingTranslatorOptions ¶
type LibreOptions ¶
type LibreTranslateInput ¶
type MockTranlator ¶
type MockTranlator struct{}
type SupportedLanguage ¶
type Translator ¶
type Translator struct { SupportedLanguages map[string]string sync.RWMutex LibreOptions }
func NewLibreTranslator ¶
func NewLibreTranslator(options ...LibreOptions) (t Translator, err error)
Based on https://libretranslate.com/docs/#/ See also https://github.com/LibreTranslate/LibreTranslate There is also a more complete binding at https://github.com/LibreTranslate/LibreTranslate
func (*Translator) GetLanguages ¶
func (t *Translator) GetLanguages() ([]SupportedLanguage, error)
func (*Translator) IsValidLanguage ¶
func (t *Translator) IsValidLanguage(lang ...string) error
type TranslatorOptions ¶
type TranslatorProvider ¶
func NewTranslator ¶
func NewTranslator(options TranslatorOptions) (TranslatorProvider, error)
Click to show internal directories.
Click to hide internal directories.