feat: i18n

This commit is contained in:
meilin.huang
2024-11-20 22:43:53 +08:00
parent 74ae031853
commit 99a746085b
308 changed files with 8177 additions and 3880 deletions

View File

@@ -5,7 +5,9 @@ import (
"mayfly-go/internal/sys/application"
"mayfly-go/internal/sys/domain/entity"
"mayfly-go/pkg/biz"
"mayfly-go/pkg/config"
"mayfly-go/pkg/req"
"mayfly-go/pkg/utils/collx"
)
type Config struct {
@@ -22,7 +24,7 @@ func (c *Config) Configs(rc *req.Ctx) {
func (c *Config) GetConfigValueByKey(rc *req.Ctx) {
key := rc.Query("key")
biz.NotEmpty(key, "key不能为空")
biz.NotEmpty(key, "key cannot be empty")
config := c.ConfigApp.GetConfig(key)
// 判断是否为公开配置
@@ -40,3 +42,9 @@ func (c *Config) SaveConfig(rc *req.Ctx) {
rc.ReqParam = form
biz.ErrIsNil(c.ConfigApp.Save(rc.MetaCtx, config))
}
// GetServerConfig 获取当前系统启动配置
func (c *Config) GetServerConfig(rc *req.Ctx) {
conf := config.Conf
rc.ResData = collx.Kvs("i18n", conf.Server.Lang)
}