mirror of
https://github.com/eeeXun/GTT.git
synced 2025-05-17 00:00:16 -07:00
refactor: set api key in for-loop
This commit is contained in:
parent
16cee7c895
commit
457549b7cc
@ -113,11 +113,10 @@ func configInit() {
|
|||||||
uiStyle.SetSrcBorderColor(config.GetString("source.border_color")).
|
uiStyle.SetSrcBorderColor(config.GetString("source.border_color")).
|
||||||
SetDstBorderColor(config.GetString("destination.border_color"))
|
SetDstBorderColor(config.GetString("destination.border_color"))
|
||||||
// Set API Keys
|
// Set API Keys
|
||||||
if config.Get("api_key.chatgpt") != nil {
|
for _, name := range []string{"ChatGPT", "DeepL"} {
|
||||||
translators["ChatGPT"].SetAPIKey(config.GetString("api_key.chatgpt"))
|
if config.Get(fmt.Sprintf("api_key.%s", name)) != nil {
|
||||||
|
translators[name].SetAPIKey(config.GetString(fmt.Sprintf("api_key.%s", name)))
|
||||||
}
|
}
|
||||||
if config.Get("api_key.deepl") != nil {
|
|
||||||
translators["DeepL"].SetAPIKey(config.GetString("api_key.deepl"))
|
|
||||||
}
|
}
|
||||||
// Set argument language
|
// Set argument language
|
||||||
if len(*srcLangArg) > 0 {
|
if len(*srcLangArg) > 0 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user