1
0

feat: 多语言处理tkey

This commit is contained in:
TsMask
2023-11-21 14:42:37 +08:00
parent f490d9af0f
commit d5d3feb5fc
61 changed files with 1381 additions and 757 deletions

View File

@@ -57,5 +57,15 @@ func (s *CommontController) I18n(c *gin.Context) {
// GET /sys-conf
func (s *CommontController) SysConfig(c *gin.Context) {
data := s.commontService.SystemConfigInfo()
// 闭包函数处理多语言
language := ctx.AcceptLanguage(c)
converI18n := func(language string, arr *map[string]string) {
for k, v := range *arr {
(*arr)[k] = i18n.TKey(language, v)
}
}
converI18n(language, &data)
c.JSON(200, result.OkData(data))
}