1
0

Make a lang cookie accessible in JS for translation.

This commit is contained in:
Alexander Andreev 2024-09-15 15:03:13 +04:00
parent 439e25b28c
commit 2904a07088
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

View File

@ -129,7 +129,7 @@ func I18nMiddleware(next http.Handler) http.Handler {
lang := "en" lang := "en"
if lq := r.URL.Query().Get("lang"); lq != "" { if lq := r.URL.Query().Get("lang"); lq != "" {
lc := http.Cookie{Name: "lang", Value: lq, HttpOnly: true, MaxAge: 0} lc := http.Cookie{Name: "lang", Value: lq, HttpOnly: false, MaxAge: 0}
http.SetCookie(w, &lc) http.SetCookie(w, &lc)
lang = lq lang = lq
} else if l, err := r.Cookie("lang"); err == nil { } else if l, err := r.Cookie("lang"); err == nil {