Unverified Commit 421db984 authored by Eric_Lee's avatar Eric_Lee Committed by GitHub

修复语言设置无效的问题 (#84)

parent 8c252932
...@@ -51,7 +51,7 @@ func (c *Config) EnsureConfigValid() { ...@@ -51,7 +51,7 @@ func (c *Config) EnsureConfigValid() {
if c.LanguageCode != "" && c.Language == "" { if c.LanguageCode != "" && c.Language == "" {
c.Language = c.LanguageCode c.Language = c.LanguageCode
} }
if c.Language == ""{ if c.Language == "" {
c.Language = "zh" c.Language = "zh"
} }
// 确保至少有一个认证 // 确保至少有一个认证
......
...@@ -41,7 +41,7 @@ func (mi *MenuItem) Text() string { ...@@ -41,7 +41,7 @@ func (mi *MenuItem) Text() string {
type Menu []MenuItem type Menu []MenuItem
func init() { func Initial() {
defaultTitle = utils.WrapperTitle(i18n.T("Welcome to use Jumpserver open source fortress system")) defaultTitle = utils.WrapperTitle(i18n.T("Welcome to use Jumpserver open source fortress system"))
menu = Menu{ menu = Menu{
{id: 1, instruct: "ID", helpText: i18n.T("directly login")}, {id: 1, instruct: "ID", helpText: i18n.T("directly login")},
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/jumpserver/koko/pkg/config" "github.com/jumpserver/koko/pkg/config"
) )
func init() { func Initial()() {
cf := config.GetConf() cf := config.GetConf()
localePath := path.Join(cf.RootPath, "locale") localePath := path.Join(cf.RootPath, "locale")
if strings.HasPrefix(cf.Language, "zh") { if strings.HasPrefix(cf.Language, "zh") {
......
...@@ -9,6 +9,7 @@ import ( ...@@ -9,6 +9,7 @@ import (
"github.com/jumpserver/koko/pkg/config" "github.com/jumpserver/koko/pkg/config"
"github.com/jumpserver/koko/pkg/httpd" "github.com/jumpserver/koko/pkg/httpd"
"github.com/jumpserver/koko/pkg/i18n"
"github.com/jumpserver/koko/pkg/logger" "github.com/jumpserver/koko/pkg/logger"
"github.com/jumpserver/koko/pkg/service" "github.com/jumpserver/koko/pkg/service"
"github.com/jumpserver/koko/pkg/sshd" "github.com/jumpserver/koko/pkg/sshd"
...@@ -45,6 +46,7 @@ func RunForever() { ...@@ -45,6 +46,7 @@ func RunForever() {
func bootstrap() { func bootstrap() {
config.Initial() config.Initial()
i18n.Initial()
logger.Initial() logger.Initial()
service.Initial() service.Initial()
Initial() Initial()
......
...@@ -15,6 +15,7 @@ import ( ...@@ -15,6 +15,7 @@ import (
var sshServer *ssh.Server var sshServer *ssh.Server
func StartServer() { func StartServer() {
handler.Initial()
conf := config.GetConf() conf := config.GetConf()
hostKey := HostKey{Value: conf.HostKey, Path: conf.HostKeyFile} hostKey := HostKey{Value: conf.HostKey, Path: conf.HostKeyFile}
logger.Debug("Loading host key") logger.Debug("Loading host key")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment