Documentation
¶
Index ¶
- Constants
- type Client
- type HTTPError
- type TranslateOption
- func Formality(formality string) TranslateOption
- func GlossaryId(glossary string) TranslateOption
- func IgnoreTags(tags string) TranslateOption
- func NonSplittingTags(tags string) TranslateOption
- func OutlineDetection(detect string) TranslateOption
- func PreserveFormatting(preserve string) TranslateOption
- func SourceLang(lang string) TranslateOption
- func SplitSentences(split string) TranslateOption
- func SplittingTags(tags string) TranslateOption
- func TagHandling(handling string) TranslateOption
- type Translation
- type Translator
- type TranslatorOptions
Constants ¶
const ( BaseURLPro = "https://api.deepl.com/v2" BaseURLFree = "https://api-free.deepl.com/v2" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TranslateOption ¶
func Formality ¶
func Formality(formality string) TranslateOption
Sets whether the translated text should lean towards formal or informal language.
func GlossaryId ¶
func GlossaryId(glossary string) TranslateOption
Specify the glossary to use for the translation.
func IgnoreTags ¶
func IgnoreTags(tags string) TranslateOption
Comma-separated list of XML tags that indicate text not to be translated.
func NonSplittingTags ¶
func NonSplittingTags(tags string) TranslateOption
Comma-separated list of XML tags which never split sentences.
func OutlineDetection ¶
func OutlineDetection(detect string) TranslateOption
Disable the automatic detection of the XML structure.
func PreserveFormatting ¶
func PreserveFormatting(preserve string) TranslateOption
Sets whether the translation engine should respect the original formatting, even if it would usually correct some aspects.
func SourceLang ¶
func SourceLang(lang string) TranslateOption
The language to be translated. If this parameter is omitted, the API will attempt to detect the language of the text and translate it.
func SplitSentences ¶
func SplitSentences(split string) TranslateOption
Sets whether the translation engine should first split the input into sentences.
func SplittingTags ¶
func SplittingTags(tags string) TranslateOption
Comma-separated list of XML tags which always cause splts.
func TagHandling ¶
func TagHandling(handling string) TranslateOption
Sets which kind of tags should be handled.
type Translation ¶
type Translator ¶
type Translator struct {
// contains filtered or unexported fields
}
func NewTranslator ¶
func NewTranslator(authKey string, options TranslatorOptions) *Translator
func (*Translator) TranslateText ¶
func (t *Translator) TranslateText(texts []string, targetLang string, options ...TranslateOption) ([]Translation, error)
The translate function.
type TranslatorOptions ¶
type TranslatorOptions struct {
ServerUrl string `default:""`
}