feat: fix bug in GetAcceptLanguage() (#1237)

Co-authored-by: Gucheng Wang <nomeguy@qq.com>
This commit is contained in:
Mr Forest 2022-10-25 10:50:10 +08:00 committed by GitHub
parent ac7a510949
commit d4b587b93e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,6 +56,9 @@ func (c *ApiController) T(error string) string {
// GetAcceptLanguage ...
func (c *ApiController) GetAcceptLanguage() string {
lang := c.Ctx.Request.Header.Get("Accept-Language")
if lang == "" {
lang = "en"
}
return lang[0:2]
}