Skip to content

Commit

Permalink
Merge branch 'feature/fork_241105'
Browse files Browse the repository at this point in the history
# Conflicts:
#	main.go
#	translate/translate.go
  • Loading branch information
IFLYTEK\yuchen48 committed Nov 5, 2024
2 parents a82ecfd + b0de517 commit 43fc0b6
Show file tree
Hide file tree
Showing 4 changed files with 305 additions and 328 deletions.
18 changes: 7 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* @Author: Vincent Yang
* @Date: 2023-07-01 21:45:34
* @LastEditors: Vincent Young
* @LastEditTime: 2024-09-16 12:12:35
* @LastEditors: Vincent Yang
* @LastEditTime: 2024-11-01 13:04:50
* @FilePath: /DeepLX/main.go
* @Telegram: https://t.me/missuo
* @GitHub: https://github.com/missuo
Expand Down Expand Up @@ -131,7 +131,7 @@ func main() {
return
}

result, err := translate.TranslateByDeepLX(sourceLang, targetLang, translateText, tagHandling, proxyURL)
result, err := translate.TranslateByDeepLX(sourceLang, targetLang, translateText, tagHandling, proxyURL, "")
if err != nil {
log.Fatalf("Translation failed: %s", err)
}
Expand Down Expand Up @@ -168,8 +168,6 @@ func main() {

dlSession := cfg.DlSession

// fmt.Printf("ENV DL_SESSION: %s\n", cfg.DlSession)

if tagHandling != "" && tagHandling != "html" && tagHandling != "xml" {
c.JSON(http.StatusBadRequest, gin.H{
"code": http.StatusBadRequest,
Expand All @@ -187,12 +185,10 @@ func main() {
}
}

// log.Printf("dlSession: %s\n", dlSession)

if dlSession == "" {
c.JSON(http.StatusUnauthorized, gin.H{
"code": http.StatusUnauthorized,
"message": "No dl_session Found.",
"message": "No dl_session Found",
})
return
} else if strings.Contains(dlSession, ".") {
Expand All @@ -203,7 +199,7 @@ func main() {
return
}

result, err := translate.TranslateByDeepLXPro(sourceLang, targetLang, translateText, tagHandling, dlSession, proxyURL)
result, err := translate.TranslateByDeepLX(sourceLang, targetLang, translateText, tagHandling, proxyURL, dlSession)
if err != nil {
log.Fatalf("Translation failed: %s", err)
}
Expand Down Expand Up @@ -262,7 +258,7 @@ func main() {
return
}

result, err := translate.TranslateByDeepLXPro(sourceLang, targetLang, translateText, tagHandling, dlSession, proxyURL)
result, err := translate.TranslateByDeepLX(sourceLang, targetLang, translateText, tagHandling, proxyURL, dlSession)
if err != nil {
log.Fatalf("Translation failed: %s", err)
}
Expand Down Expand Up @@ -314,7 +310,7 @@ func main() {
targetLang = jsonData.TargetLang
}

result, err := translate.TranslateByDeepLX("", targetLang, translateText, "", proxyURL)
result, err := translate.TranslateByDeepLX("", targetLang, translateText, "", proxyURL, "")
if err != nil {
log.Fatalf("Translation failed: %s", err)
}
Expand Down
Loading

0 comments on commit 43fc0b6

Please sign in to comment.