summaryrefslogtreecommitdiffhomepage
path: root/middleware/i18n.go
diff options
context:
space:
mode:
Diffstat (limited to 'middleware/i18n.go')
-rw-r--r--middleware/i18n.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/middleware/i18n.go b/middleware/i18n.go
index a30a9f6..0ed07d4 100644
--- a/middleware/i18n.go
+++ b/middleware/i18n.go
@@ -12,13 +12,11 @@ import (
"git.thomasvoss.com/euro-cash.eu/templates"
)
-const PrinterKey = "printer"
-
func I18n(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var p, pZero i18n.Printer
- if c, err := r.Cookie("lang"); errors.Is(err, http.ErrNoCookie) {
+ if c, err := r.Cookie("locale"); errors.Is(err, http.ErrNoCookie) {
log.Println("Language cookie not set")
} else {
var ok bool
@@ -29,7 +27,7 @@ func I18n(next http.Handler) http.Handler {
}
ctx := context.WithValue(
- r.Context(), PrinterKey, cmp.Or(p, i18n.DefaultPrinter))
+ r.Context(), "printer", cmp.Or(p, i18n.DefaultPrinter))
if p == pZero {
http.SetCookie(w, &http.Cookie{