Skip to content

Commit

Permalink
refactor: update languageDetector (#2043)
Browse files Browse the repository at this point in the history
  • Loading branch information
710leo authored Jul 18, 2024
1 parent cd0c478 commit 6c4ddfc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion center/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ func languageDetector(i18NHeaderKey string) gin.HandlerFunc {
if headerKey != "" {
lang := c.GetHeader(headerKey)
if lang != "" {
if strings.HasPrefix(lang, "zh") {
if strings.HasPrefix(lang, "zh_HK") {
c.Request.Header.Set("X-Language", "zh_HK")
} else if strings.HasPrefix(lang, "zh") {
c.Request.Header.Set("X-Language", "zh_CN")
} else if strings.HasPrefix(lang, "en") {
c.Request.Header.Set("X-Language", "en")
Expand Down

0 comments on commit 6c4ddfc

Please sign in to comment.