fix: sync env config (#319)
This commit is contained in:
parent
0038092193
commit
b26f5d2bde
|
@ -6,6 +6,7 @@ import (
|
|||
"github.com/adrg/sysfont"
|
||||
runtime2 "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
"net/http"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
|
@ -50,6 +51,7 @@ func (p *preferencesService) SetPreferences(pf types.Preferences) (resp types.JS
|
|||
return
|
||||
}
|
||||
|
||||
p.UpdateEnv()
|
||||
resp.Success = true
|
||||
return
|
||||
}
|
||||
|
@ -114,6 +116,11 @@ func (p *preferencesService) GetBuildInDecoder() (resp types.JSResp) {
|
|||
return
|
||||
}
|
||||
|
||||
func (p *preferencesService) GetLanguage() string {
|
||||
pref := p.pref.GetPreferences()
|
||||
return pref.General.Language
|
||||
}
|
||||
|
||||
func (p *preferencesService) SetAppVersion(ver string) {
|
||||
if !strings.HasPrefix(ver, "v") {
|
||||
p.clientVersion = "v" + ver
|
||||
|
@ -246,3 +253,12 @@ func (p *preferencesService) CheckForUpdate() (resp types.JSResp) {
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateEnv Update System Environment
|
||||
func (p *preferencesService) UpdateEnv() {
|
||||
if p.GetLanguage() == "zh" {
|
||||
os.Setenv("LANG", "zh_CN.UTF-8")
|
||||
} else {
|
||||
os.Unsetenv("LANG")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue