microsoft

package
Version: v0.0.0-...-d13056a Latest Latest
Warning

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

Go to latest
Published: May 9, 2017 License: Apache-2.0 Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTranslator

func NewTranslator(subscriptionKey string) translator.Translator

NewTranslator returns a struct that implements the Translator interface by exposing a Translate and a Languages function that are backed by Microsoft's translation API. The function takes the subscriptionKey for a registered Text Translation Service. Details on how to get such a key: http://docs.microsofttranslator.com/text-translate.html.

Types

type LanguageCatalog

type LanguageCatalog interface {
	Languages() ([]translator.Language, error)
}

The LanguageCatalog provides a slice of languages representing all languages supported by Microsoft's Translation API.

type LanguageProvider

type LanguageProvider interface {
	Codes() ([]string, error)
	Names(codes []string) ([]string, error)
}

The LanguageProvider retrieves the names and codes of all languages supported by Microsoft's Translation API.

type Router

type Router interface {
	AuthURL() string
	TranslationURL() string
	DetectURL() string
	LanguageNamesURL() string
	LanguageCodesURL() string
}

The Router provides necessary URLs to communicate with Microsoft's API.

type TranslationProvider

type TranslationProvider interface {
	Translate(text, from, to string) (string, error)
	Detect(text string) (string, error)
}

The TranslationProvider communicates with Microsoft's API to provide a translation for a given text.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL