service

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.4.0

type Config struct {
	SourceLang      string
	PivotLang       string
	DiffOnly        bool
	CopyToClipboard bool
}

type DeeplRequestResponse

type DeeplRequestResponse struct {
	Translations []DeeplRequestResponseTranslation
}

type DeeplRequestResponseTranslation

type DeeplRequestResponseTranslation struct {
	DetectedSourceLanguage string `json:"detected_source_language"`
	Text                   string `json:"text"`
}

type DeeplRequestUsage

type DeeplRequestUsage struct {
	CharacterCount int64 `json:"character_count"`
	CharacterLimit int64 `json:"character_limit"`
}

type GoogleRequestResponse added in v0.4.0

type GoogleRequestResponse struct {
	Data GoogleTranslateTextResponseList `json:"data"`
}

type GoogleRequestUsage added in v0.4.0

type GoogleRequestUsage struct {
	CharacterCount int64 `json:"character_count"`
	CharacterLimit int64 `json:"character_limit"`
}

type GoogleTranslateTextResponseList added in v0.4.0

type GoogleTranslateTextResponseList struct {
	Translations []GoogleTranslateTextResponseTranslation `json:"translations"`
}

type GoogleTranslateTextResponseTranslation added in v0.4.0

type GoogleTranslateTextResponseTranslation struct {
	DetectedSourceLanguage string `json:"detectedSourceLanguage"`
	Model                  string `json:"model"`
	Text                   string `json:"translatedText"`
}

type T2 added in v0.4.0

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

func NewT2

func NewT2(c Config, ts TranslationService) T2

func (T2) TraductionTranslation added in v0.4.0

func (t2 T2) TraductionTranslation(t string) error

type TranslationDeepl

type TranslationDeepl struct {
	Endpoint string
	ApiKey   string
}

func (TranslationDeepl) Name added in v0.4.0

func (d TranslationDeepl) Name() string

func (TranslationDeepl) Translate

func (d TranslationDeepl) Translate(text string, source string, target string) (TranslationResponse, error)

func (TranslationDeepl) Usage

func (d TranslationDeepl) Usage() (UsageResponse, error)

type TranslationGoogle added in v0.4.0

type TranslationGoogle struct {
	Endpoint string
	ApiKey   string
}

func (TranslationGoogle) Name added in v0.4.0

func (d TranslationGoogle) Name() string

func (TranslationGoogle) Translate added in v0.4.0

func (d TranslationGoogle) Translate(text string, source string, target string) (TranslationResponse, error)

func (TranslationGoogle) Usage added in v0.4.0

func (d TranslationGoogle) Usage() (UsageResponse, error)

type TranslationResponse

type TranslationResponse struct {
	Text string
}

type TranslationService added in v0.4.0

type TranslationService interface {
	Name() string
	Translate(text string, source string, target string) (TranslationResponse, error)
	Usage() (UsageResponse, error)
}

type UsageResponse

type UsageResponse struct {
	Used  int64
	Limit int64
}

Jump to

Keyboard shortcuts

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