Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

update: use default language option in value

LinkinStard16ecc99628e
diff --git a/cmd/answer/wire_gen.go b/cmd/answer/wire_gen.go
index 475a61af..302a67de 100644
--- a/cmd/answer/wire_gen.go
+++ b/cmd/answer/wire_gen.go
@@ -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)
diff --git a/internal/controller/lang_controller.go b/internal/controller/lang_controller.go
index 1e947adf..b48080ee 100644
--- a/internal/controller/lang_controller.go
+++ b/internal/controller/lang_controller.go
@@ -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...)
}
diff --git a/internal/service/user_service.go b/internal/service/user_service.go
index 6447184e..76ce0d8a 100644
--- a/internal/service/user_service.go
+++ b/internal/service/user_service.go
@@ -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
}