backend_full

package
v0.0.0-...-9044698 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2016 License: MIT Imports: 6 Imported by: 2

Documentation

Overview

Copyright 2016 Home24 AG. All rights reserved. Proprietary license.

Copyright 2016 Home24 AG. All rights reserved. Proprietary license.

Copyright 2016 Home24 AG. All rights reserved. Proprietary license.

Copyright 2016 Home24 AG. All rights reserved. Proprietary license.

Index

Constants

View Source
const BG_URL = "https://api.datamarket.azure.com/Bing/MicrosoftTranslator/v1/Translate"
View Source
const GT_URL = "https://www.googleapis.com/language/translate/v2"
View Source
const YT_URL = "https://translate.yandex.net/api/v1.5/tr.json/translate"

Variables

This section is empty.

Functions

This section is empty.

Types

type BingResponse

type BingResponse struct {
	Lang string
	Data struct {
		Results []struct {
			Text string `json:"Text"`
		} `json:"results"`
	} `json:"d"`
}

func (*BingResponse) GetLang

func (r *BingResponse) GetLang() string

func (*BingResponse) GetName

func (r *BingResponse) GetName() string

func (*BingResponse) GetSource

func (r *BingResponse) GetSource() (s string)

func (*BingResponse) GetText

func (r *BingResponse) GetText() string

type BingTranslator

type BingTranslator struct {
	// contains filtered or unexported fields
}

func (*BingTranslator) GetName

func (r *BingTranslator) GetName() string

func (*BingTranslator) TranslateFull

func (t *BingTranslator) TranslateFull(text string, language string) IBackendFullResponse

type GoogleResponse

type GoogleResponse struct {
	Lang string
	Data *struct {
		Translations []struct {
			Text   string `json:"translatedText"`
			Source string `json:"detectedSourceLanguage"`
		} `json:"translations"`
	} `json:"data"`
	Error *struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	} `json:"error"`
}

func (*GoogleResponse) GetLang

func (r *GoogleResponse) GetLang() string

func (*GoogleResponse) GetName

func (r *GoogleResponse) GetName() string

func (*GoogleResponse) GetSource

func (r *GoogleResponse) GetSource() string

func (*GoogleResponse) GetText

func (r *GoogleResponse) GetText() string

func (*GoogleResponse) IsOk

func (r *GoogleResponse) IsOk() bool

type GoogleTranslator

type GoogleTranslator struct {
	// contains filtered or unexported fields
}

func (*GoogleTranslator) GetName

func (r *GoogleTranslator) GetName() string

func (*GoogleTranslator) TranslateFull

func (t *GoogleTranslator) TranslateFull(text string, language string) IBackendFullResponse

type IBackendFull

type IBackendFull interface {
	TranslateFull(text string, language string) (data IBackendFullResponse)
	GetName() string
}

func NewBingTranslator

func NewBingTranslator(client *http.Client, key string) IBackendFull

func NewGoogleTranslator

func NewGoogleTranslator(client *http.Client, key string) IBackendFull

func NewYandexTranslator

func NewYandexTranslator(client *http.Client, key string) IBackendFull

type IBackendFullResponse

type IBackendFullResponse interface {
	GetText() string
	GetSource() string
	GetLang() string
}

type YandexResponse

type YandexResponse struct {
	Code int      `json:"code"`
	Lang string   `json:"lang"`
	Text []string `json:"text"`
}

func (*YandexResponse) GetLang

func (r *YandexResponse) GetLang() string

func (*YandexResponse) GetName

func (r *YandexResponse) GetName() string

func (*YandexResponse) GetSource

func (r *YandexResponse) GetSource() string

func (*YandexResponse) GetText

func (r *YandexResponse) GetText() string

type YandexTranslator

type YandexTranslator struct {
	// contains filtered or unexported fields
}

func (*YandexTranslator) GetName

func (r *YandexTranslator) GetName() string

func (*YandexTranslator) TranslateFull

func (t *YandexTranslator) TranslateFull(text string, language string) IBackendFullResponse

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL