translate

package
v0.0.0-...-368faf9 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*translate.Client
}

Client is a client for the translate API.

func (*Client) Close

func (c *Client) Close()

Close closes the connection.

func (*Client) GetSupportedLanguages

func (c *Client) GetSupportedLanguages(ctx context.Context, target language.Tag) ([]translate.Language, error)

GetSupportedLanguages gets support languages.

func (*Client) Translate

func (c *Client) Translate(ctx context.Context, source, target string, contents []string) ([]translate.Translation, error)

Translate translates text.

type Translator

type Translator interface {
	Translate(ctx context.Context, source, target string, contents []string) ([]translate.Translation, error)
	GetSupportedLanguages(ctx context.Context, target language.Tag) ([]translate.Language, error)
	Close()
}

Translator is a translator client interface.

func New

func New(ctx context.Context, apiKey string) (Translator, error)

New returns translator client interface.

Jump to

Keyboard shortcuts

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