mirror of
https://github.com/flipped-aurora/gin-vue-admin.git
synced 2026-09-21 20:35:16 +00:00
+ Add initial multi-language support for the backend server.
+ Add language option to config.yaml (currently support en (English), zh (Chinese), ar (Arabic) languages). + Update English translation. + Add language selection support for init module. + Translated history component. + Translated setting module.
This commit is contained in:
committed by
Mohamed Hassan
parent
62f1451a70
commit
4d08788af2
@@ -30,6 +30,17 @@ func (i *DBApi) InitDB(c *gin.Context) {
|
||||
response.FailWithMessage("参数校验不通过", c)
|
||||
return
|
||||
}
|
||||
|
||||
// added by mohamed hassan to allow multilanguage support
|
||||
if dbInfo.Language != "" {
|
||||
if dbInfo.Language == "en" || dbInfo.Language == "zh" || dbInfo.Language == "ar" {
|
||||
global.GVA_CONFIG.Language = dbInfo.Language // set intial database and system langauge here
|
||||
} else {
|
||||
global.GVA_CONFIG.Language = "en" // set defualt language to initialize database and system to english
|
||||
}
|
||||
}
|
||||
// end of adding
|
||||
|
||||
if err := initDBService.InitDB(dbInfo); err != nil {
|
||||
global.GVA_LOG.Error("自动创建数据库失败!", zap.Error(err))
|
||||
response.FailWithMessage("自动创建数据库失败,请查看后台日志,检查后在进行初始化", c)
|
||||
|
||||
@@ -203,3 +203,5 @@ cors:
|
||||
allow-methods: GET, POST
|
||||
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
|
||||
allow-credentials: true # 布尔值
|
||||
# added by mohamed hassan to support multilanguage
|
||||
language: ''
|
||||
@@ -27,4 +27,7 @@ type Server struct {
|
||||
|
||||
// 跨域配置
|
||||
Cors CORS `mapstructure:"cors" json:"cors" yaml:"cors"`
|
||||
|
||||
// added by mohamed hassan to support multi-language
|
||||
Language string `mapstructure:"language" json:"language" yaml:"language"`
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ type InitDB struct {
|
||||
UserName string `json:"userName" binding:"required"` // 数据库用户名
|
||||
Password string `json:"password"` // 数据库密码
|
||||
DBName string `json:"dbName" binding:"required"` // 数据库名
|
||||
Language string `json:"language",omitempty` // DB initial langauge // added by mohamed hassan to support multilanguage
|
||||
}
|
||||
|
||||
// MysqlEmptyDsn msyql 空数据库 建库链接
|
||||
|
||||
Reference in New Issue
Block a user