Skip to content

Commit

Permalink
fix: Compatible with the previous "zh" language (#968)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeessy2 authored Jan 11, 2024
1 parent eec9840 commit f6bc8b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,19 @@ func GetConfigCached() (conf Config, err error) {
cache.ConfigSingle.NotAllowWanAccess = true
}

// 初始化语言
util.InitLogLang(cache.ConfigSingle.Lang)

// remove err
cache.Err = nil
return *cache.ConfigSingle, err
}

// CompatibleConfig 兼容v5.0.0之前的配置文件
func (conf *Config) CompatibleConfig() {
// 如配置文件不为空, 兼容之前的语言为中文
if conf.Lang == "" {
conf.Lang = "zh"
}

// 兼容v5.0.0之前的配置文件
if len(conf.DnsConf) > 0 {
return
}
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ func run() {
// 兼容v5.0.0之前的配置文件
conf, _ := config.GetConfigCached()
conf.CompatibleConfig()
// 初始化语言
util.InitLogLang(conf.Lang)

if !*noWebService {
go func() {
Expand Down

0 comments on commit f6bc8b4

Please sign in to comment.