diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-08-07 01:51:13 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-08-07 01:51:13 +0200 |
commit | 3cb7572a8f1092b3169f4faaa2e76776dea39993 (patch) | |
tree | 62bdfdf1547fa88f5b25e4da1aac8d734906509f /main.go | |
parent | e555accb612e189ab9bdad403958d4e0a6d809ae (diff) |
Just use hardcoded strings
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -40,7 +40,7 @@ func main() { } func finalHandler(w http.ResponseWriter, r *http.Request) { - p := r.Context().Value(middleware.PrinterKey).(i18n.Printer) + p := r.Context().Value("printer").(i18n.Printer) /* Strip trailing slash from the URL */ path := r.URL.Path @@ -57,7 +57,7 @@ func finalHandler(w http.ResponseWriter, r *http.Request) { } func setUserLanguage(w http.ResponseWriter, r *http.Request) { - loc := r.FormValue(templates.LocaleKey) + loc := r.FormValue("locale") _, ok := i18n.Printers[strings.ToLower(loc)] if !ok { w.WriteHeader(http.StatusBadRequest) @@ -65,7 +65,7 @@ func setUserLanguage(w http.ResponseWriter, r *http.Request) { return } http.SetCookie(w, &http.Cookie{ - Name: "lang", + Name: "locale", Value: loc, MaxAge: math.MaxInt32, }) |