Make a lang cookie accessible in JS for translation.
This commit is contained in:
parent
439e25b28c
commit
2904a07088
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user