mirror of
https://github.com/watn3y/steamsalty.git
synced 2025-10-25 17:51:04 +02:00
feat: Automatic comment translation using DeepL
Some checks failed
Build and Push to Docker Hub on push to any branch / docker (push) Has been cancelled
Some checks failed
Build and Push to Docker Hub on push to any branch / docker (push) Has been cancelled
This commit is contained in:
parent
c6c7480493
commit
1e94b1fc1e
10 changed files with 250 additions and 20 deletions
35
deepL/types.go
Normal file
35
deepL/types.go
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package deepl
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type translateResponse struct {
|
||||
Translations []struct {
|
||||
DetectedSourceLanguage string `json:"detected_source_language"`
|
||||
Text string `json:"text"`
|
||||
} `json:"translations"`
|
||||
}
|
||||
|
||||
type translateRequest struct {
|
||||
Text []string `json:"text"`
|
||||
TargetLang string `json:"target_lang"`
|
||||
}
|
||||
|
||||
type languagesResponse []struct {
|
||||
Language string `json:"language"`
|
||||
Name string `json:"name"`
|
||||
SupportsFormality bool `json:"supports_formality"` //unused
|
||||
}
|
||||
|
||||
|
||||
type apiClient struct {
|
||||
authKey string
|
||||
baseURL string
|
||||
httpClient *http.Client
|
||||
}
|
||||
|
||||
const (
|
||||
baseURLPro = "https://api.deepl.com/v2"
|
||||
baseURLFree = "https://api-free.deepl.com/v2"
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue