Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommonJobParams ¶
type CommonJobParams struct { Formality string `json:"formality"` // Can be "undefined" TranscribeAs string `json:"transcribe_as"` Mode string `json:"mode"` WasSpoken bool `json:"wasSpoken"` AdvancedMode bool `json:"advancedMode"` TextType string `json:"textType"` RegionalVariant string `json:"regionalVariant,omitempty"` }
CommonJobParams represents common parameters for translation jobs
type DeepLXTranslationResult ¶
type DeepLXTranslationResult struct { Code int `json:"code"` ID int64 `json:"id"` Message string `json:"message,omitempty"` Data string `json:"data"` // The primary translated text Alternatives []string `json:"alternatives"` // Other possible translations SourceLang string `json:"source_lang"` TargetLang string `json:"target_lang"` Method string `json:"method"` }
DeepLXTranslationResult represents the final translation result
func TranslateByDeepLX ¶
func TranslateByDeepLX(sourceLang, targetLang, text string, tagHandling string, proxyURL string, dlSession string) (DeepLXTranslationResult, error)
TranslateByDeepLX performs translation using DeepL API
type Job ¶ added in v0.9.9
type Job struct { Kind string `json:"kind"` PreferredNumBeams int `json:"preferred_num_beams"` RawEnContextBefore []string `json:"raw_en_context_before"` RawEnContextAfter []string `json:"raw_en_context_after"` Sentences []Sentence `json:"sentences"` }
Job represents a translation job
type Lang ¶
type Lang struct { SourceLangUserSelected string `json:"source_lang_user_selected"` // Can be "auto" TargetLang string `json:"target_lang"` SourceLangComputed string `json:"source_lang_computed,omitempty"` }
Lang represents the language settings for translation
type Params ¶
type Params struct { CommonJobParams CommonJobParams `json:"commonJobParams"` Lang Lang `json:"lang"` Jobs []Job `json:"jobs"` Timestamp int64 `json:"timestamp"` }
Params represents parameters for translation requests
type PostData ¶
type PostData struct { Jsonrpc string `json:"jsonrpc"` Method string `json:"method"` ID int64 `json:"id"` Params Params `json:"params"` }
PostData represents the complete translation request
type SentenceResponse ¶ added in v1.0.6
SentenceResponse is a helper struct for the response sentences
type TranslationResponse ¶
type TranslationResponse struct { Jsonrpc string `json:"jsonrpc"` ID int64 `json:"id"` Result struct { Translations []struct { Beams []struct { Sentences []SentenceResponse `json:"sentences"` NumSymbols int `json:"num_symbols"` RephraseVariant struct { Name string `json:"name"` } `json:"rephrase_variant"` } `json:"beams"` Quality string `json:"quality"` // Added quality } `json:"translations"` TargetLang string `json:"target_lang"` SourceLang string `json:"source_lang"` SourceLangIsConfident bool `json:"source_lang_is_confident"` DetectedLanguages map[string]interface{} `json:"detectedLanguages"` // Use interface{} for now } `json:"result"` }
TranslationResponse represents the response from translation
Click to show internal directories.
Click to hide internal directories.