summaryrefslogtreecommitdiffhomepage
path: root/main.go
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-08-07 01:51:13 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-08-07 01:51:13 +0200
commit3cb7572a8f1092b3169f4faaa2e76776dea39993 (patch)
tree62bdfdf1547fa88f5b25e4da1aac8d734906509f /main.go
parente555accb612e189ab9bdad403958d4e0a6d809ae (diff)
Just use hardcoded strings
Diffstat (limited to 'main.go')
-rw-r--r--main.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/main.go b/main.go
index 6ecdf32..e0c88ef 100644
--- a/main.go
+++ b/main.go
@@ -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,
})