Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type CommonJobParameters ¶
type JsonRpcRequest ¶
type JsonRpcRequest struct { Jsonrpc string `json:"jsonrpc"` Method string `json:"method"` Id int64 `json:"id"` Params TextTranslationJsonRpcRequestParams `json:"params"` }
type JsonRpcResponse ¶
type JsonRpcResponse struct { Jsonrpc string `json:"jsonrpc"` Id int64 `json:"id"` Result TextTranslationJsonResponse `json:"result"` ErrorInfo *ErrorInfo `json:"error,omitempty"` }
func Translate ¶
func Translate(sourceLanguage, targetLanguage, textToTranslate string, options ...Option) (jsonRpcResponse *JsonRpcResponse, err error)
Translate request data. support lang code using deepL api DE: German EN: English ES: Spanish FR: French IT: Italian JA: Japanese NL: Dutch PL: Polish PT: Portuguese RU: Russian ZH: Chinese BG: Bulgarian CS: Czech DA: Danish EL: Greek ET: Estonian FI: Finnish HU: Hungarian LT: Lithuanian LV: Latvian RO: Romanian SK: Slovakian SL: Slovenian SV: Swedish
type Option ¶
type Option func(option *deepLClientOption)
func WithHttpProxy ¶
WithHttpProxy set http proxy.if both httpProxy and sock5 proxy are set, http proxy will be over-wrote by sock5 proxy .example http://127.0.0.1:1080
func WithHttpProxyEx ¶ added in v1.0.5
WithHttpProxyEx set http proxy.if both httpProxy and sock5 proxy are set, http proxy will be over-wrote by sock5 proxy .example http://http://127.0.0.1:1080 ignoreSSLVerification: ignore SSL verification
func WithSocket5Proxy ¶
WithSocket5Proxy set socket5Proxy.if both httpProxy and sock5 proxy are set, http proxy will be over-wrote by sock5 proxy example 127.0.0.1:1080
func WithSocket5ProxyEx ¶ added in v1.0.5
func WithSocket5ProxyEx(socket5Proxy string, userName string, password string, ignoreSSLVerification bool) Option
WithSocket5ProxyEx set socket5Proxy.if both httpProxy and sock5 proxy are set, http proxy will be over-wrote by sock5 proxy example 127.0.0.1:1080 ignoreSSLVerification: ignore SSL verification
type TextTranslationJsonResponse ¶
type TextTranslationJsonResponse struct { Texts []TextWithAlternatives `json:"texts"` LanguageCode string `json:"lang"` LanguageIsConfident bool `json:"lang_is_confident"` DetectedLanguages map[string]float64 `json:"detectedLanguages"` }
type TextTranslationJsonRpcRequestParams ¶
type TextTranslationJsonRpcRequestParams struct { Texts []TextParam `json:"texts"` Splitting string `json:"splitting"` Lang Lang `json:"lang"` Timestamp int64 `json:"timestamp"` CommonJobParams CommonJobParameters `json:"commonJobParams"` }