mirror of https://gitee.com/answerdev/answer.git
Merge branch 'feat/language' into 'test'
update: use default language option in value See merge request opensource/answer!177
This commit is contained in:
commit
42e8dfeca9
|
@ -152,7 +152,6 @@ func initApplication(debug bool, serverConf *conf.Server, dbConf *data.Database,
|
|||
questionService := service.NewQuestionService(questionRepo, tagCommonService, questionCommon, userCommon, revisionService, metaService, collectionCommon, answerActivityService)
|
||||
questionController := controller.NewQuestionController(questionService, rankService)
|
||||
answerService := service.NewAnswerService(answerRepo, questionRepo, questionCommon, userCommon, collectionCommon, userRepo, revisionService, answerActivityService, answerCommon, voteRepo)
|
||||
siteInfoCommonService := siteinfo_common.NewSiteInfoCommonService(siteInfoRepo)
|
||||
dashboardService := dashboard.NewDashboardService(questionRepo, answerRepo, commentCommonRepo, voteRepo, userRepo, reportRepo, configRepo, siteInfoCommonService)
|
||||
answerController := controller.NewAnswerController(answerService, rankService, dashboardService)
|
||||
searchRepo := search_common.NewSearchRepo(dataData, uniqueIDRepo, userCommon)
|
||||
|
|
|
@ -64,7 +64,7 @@ func (u *LangController) GetUserLangOptions(ctx *gin.Context) {
|
|||
options := translator.LanguageOptions
|
||||
if len(siteInterfaceResp.Language) > 0 {
|
||||
defaultOption := []*translator.LangOption{
|
||||
{Label: translator.DefaultLangOption, Value: siteInterfaceResp.Language},
|
||||
{Label: translator.DefaultLangOption, Value: translator.DefaultLangOption},
|
||||
}
|
||||
options = append(defaultOption, options...)
|
||||
}
|
||||
|
|
|
@ -68,15 +68,6 @@ func (us *UserService) GetUserInfoByUserID(ctx context.Context, token, userID st
|
|||
resp = &schema.GetUserToSetShowResp{}
|
||||
resp.GetFromUserEntity(userInfo)
|
||||
resp.AccessToken = token
|
||||
|
||||
// if user choose the default language, Use the language configured by the administrator.
|
||||
if resp.Language == translator.DefaultLangOption {
|
||||
siteInterface, err := us.siteInfoService.GetSiteInterface(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.Language = siteInterface.Language
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue