translate

package
v0.0.0-...-72f9927 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepLTranslate

func DeepLTranslate(txt []string, source, target, apiKey string) ([]string, error)

DeepLTranslate translates the given slice of strings from source language to target language using the DeepL API.

func GoogleTranslate

func GoogleTranslate(txt []string, source, target, apiKey string) ([]string, error)

GoogleTranslate translates the given slice of strings from source language to target language using the Google Cloud Translation API.

func TranslationError

func TranslationError(message string, txt []string) []string

TranslationError creates a slice of strings all containing the given message. Used to put an error message in the "Translated Text" section of the GUI.

Types

type DeepLResponse

type DeepLResponse struct {
	Translations []struct {
		DetectedSourceLanguage string `json:"detected_source_language"`
		Text                   string `json:"text"`
	} `json:"translations"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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