i18n翻译

This commit is contained in:
hu xiaotong
2025-07-14 12:36:07 +08:00
parent 22b6b3c93b
commit c86598e60c
4 changed files with 451 additions and 613 deletions

View File

@@ -5,6 +5,7 @@ import (
"encoding/json"
"epic/internal/consts"
"epic/internal/dao"
"epic/internal/logic/i18n"
"epic/internal/model/dto"
"epic/internal/model/entity"
"epic/internal/util"
@@ -224,9 +225,14 @@ func (t *ThirdPartyDataSync) saveHeroData(ctx context.Context, hero *dto.ThirdPa
status60 := hero.CalculatedStatus["Lv60SixStarFullyAwakened"]
status60json, _ := gjson.EncodeString(status60)
heroJson, _ := gjson.EncodeString(hero)
// 使用i18n服务转换字段
zhHeroName := i18n.GetZh(ctx, hero.Name)
zhRole := i18n.GetZh(ctx, hero.Role)
zhAttribute := i18n.GetZh(ctx, hero.Attribute)
newHero := &entity.EpicHeroInfo{
Id: 0,
HeroName: "",
HeroName: zhHeroName,
HeroCode: hero.Code,
HeroAttrLv60: status60json,
Creator: "",
@@ -236,10 +242,10 @@ func (t *ThirdPartyDataSync) saveHeroData(ctx context.Context, hero *dto.ThirdPa
Deleted: false,
NickName: "",
Rarity: strconv.Itoa(hero.Rarity),
Role: hero.Role,
Role: zhRole,
Zodiac: "",
HeadImgUrl: "",
Attribute: "",
Attribute: zhAttribute,
Remark: "",
RawJson: heroJson,
}