feat: 多语言处理tkey

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

No files matched your search

+10
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))
}