19 lines
270 B
Go
19 lines
270 B
Go
|
package middleware
|
||
|
|
||
|
import (
|
||
|
"github.com/gin-gonic/gin"
|
||
|
"kefu/types"
|
||
|
)
|
||
|
|
||
|
func SetLanguage(c *gin.Context) {
|
||
|
lang := c.Query("lang")
|
||
|
if lang == "" {
|
||
|
lang = c.GetHeader("lang")
|
||
|
if lang == "" {
|
||
|
lang = "cn"
|
||
|
}
|
||
|
}
|
||
|
types.ApiCode.LANG = lang
|
||
|
c.Set("lang", lang)
|
||
|
}
|