mirror of
https://github.com/eeeXun/GTT.git
synced 2025-06-01 07:20:53 -07:00
style: default language & restructure config
change default language to English change the structure of language in config
This commit is contained in:
parent
1115d19b7a
commit
6244a00630
20
config.go
20
config.go
@ -24,10 +24,10 @@ func configInit() {
|
|||||||
"theme": "Gruvbox",
|
"theme": "Gruvbox",
|
||||||
"source.borderColor": "red",
|
"source.borderColor": "red",
|
||||||
"destination.borderColor": "blue",
|
"destination.borderColor": "blue",
|
||||||
"source.googletranslate.language": "English",
|
"source.language.googletranslate": "English",
|
||||||
"destination.googletranslate.language": "Chinese (Traditional)",
|
"destination.language.googletranslate": "English",
|
||||||
"source.libretranslate.language": "English",
|
"source.language.libretranslate": "English",
|
||||||
"destination.libretranslate.language": "Chinese",
|
"destination.language.libretranslate": "English",
|
||||||
"hide_below": false,
|
"hide_below": false,
|
||||||
"translator": "LibreTranslate",
|
"translator": "LibreTranslate",
|
||||||
}
|
}
|
||||||
@ -68,8 +68,8 @@ func configInit() {
|
|||||||
|
|
||||||
// setup
|
// setup
|
||||||
for t_str, t := range translators {
|
for t_str, t := range translators {
|
||||||
t.SetSrcLang(config.GetString(fmt.Sprintf("source.%s.language", t_str)))
|
t.SetSrcLang(config.GetString(fmt.Sprintf("source.language.%s", t_str)))
|
||||||
t.SetDstLang(config.GetString(fmt.Sprintf("destination.%s.language", t_str)))
|
t.SetDstLang(config.GetString(fmt.Sprintf("destination.language.%s", t_str)))
|
||||||
}
|
}
|
||||||
translator = translators[config.GetString("translator")]
|
translator = translators[config.GetString("translator")]
|
||||||
hideBelow = config.GetBool("hide_below")
|
hideBelow = config.GetBool("hide_below")
|
||||||
@ -93,17 +93,17 @@ func updateConfig() {
|
|||||||
// Source language is not passed in argument
|
// Source language is not passed in argument
|
||||||
if len(*srcLangArg) == 0 {
|
if len(*srcLangArg) == 0 {
|
||||||
for t_str, t := range translators {
|
for t_str, t := range translators {
|
||||||
if config.GetString(fmt.Sprintf("source.%s.language", t_str)) != t.GetSrcLang() {
|
if config.GetString(fmt.Sprintf("source.language.%s", t_str)) != t.GetSrcLang() {
|
||||||
changed = true
|
changed = true
|
||||||
config.Set(fmt.Sprintf("source.%s.language", t_str), t.GetSrcLang())
|
config.Set(fmt.Sprintf("source.language.%s", t_str), t.GetSrcLang())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(*dstLangArg) == 0 {
|
if len(*dstLangArg) == 0 {
|
||||||
for t_str, t := range translators {
|
for t_str, t := range translators {
|
||||||
if config.GetString(fmt.Sprintf("destination.%s.language", t_str)) != t.GetDstLang() {
|
if config.GetString(fmt.Sprintf("destination.language.%s", t_str)) != t.GetDstLang() {
|
||||||
changed = true
|
changed = true
|
||||||
config.Set(fmt.Sprintf("destination.%s.language", t_str), t.GetDstLang())
|
config.Set(fmt.Sprintf("destination.language.%s", t_str), t.GetDstLang())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user