mirror of
https://codeberg.org/VnPower/PixivFE
synced 2024-12-06 19:16:23 +01:00
fix SetLocaleFromCookie comment
This commit is contained in:
@@ -7,11 +7,14 @@ import (
|
||||
"codeberg.org/vnpower/pixivfe/v2/server/session"
|
||||
)
|
||||
|
||||
// ProvideUserContext is a middleware that wraps an http.Handler
|
||||
// to inject a user context into each incoming request.
|
||||
// SetLocaleFromCookie is a middleware that extracts the user's locale preference
|
||||
// from a cookie and sets it in the i18n package.
|
||||
func SetLocaleFromCookie(h http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
i18n.SetLocale(session.GetCookie(r, session.Cookie_Locale))
|
||||
locale := session.GetCookie(r, session.Cookie_Locale)
|
||||
|
||||
i18n.SetLocale(locale)
|
||||
|
||||
h.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user