Documentation
¶
Index ¶
- Variables
- type CommonJobParameters
- type ErrorInfo
- type JsonRpcRequest
- type JsonRpcResponse
- type Lang
- type Option
- func WithDeeplProSession(dlSession string) Option
- func WithHttpProxy(proxy string) Option
- func WithHttpProxyEx(proxy string, ignoreSSLVerification bool) Option
- func WithSocket5Proxy(socket5Proxy string, userName string, password string) Option
- func WithSocket5ProxyEx(socket5Proxy string, userName string, password string, ...) Option
- func WithTagHandling(handingType TagHandlingType) Option
- type TagHandlingType
- type Text
- type TextParam
- type TextTranslationJsonResponse
- type TextTranslationJsonRpcRequestParams
- type TextWithAlternatives
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 WithDeeplProSession ¶ added in v1.0.6
WithDeeplProSession set deepl pro session.if session is set,
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
func WithTagHandling ¶ added in v1.0.6
func WithTagHandling(handingType TagHandlingType) Option
WithTagHandling TagHandling: type of tags to parse before translation, options are "html" and "xml" Todo: support xml options,see https://www.nuget.org/packages/DeepL.net/
type TagHandlingType ¶ added in v1.0.6
type TagHandlingType int
const ( TagHandlingHtml TagHandlingType = iota TagHandlingXml TagHandlingType = iota )
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"` }