summaryrefslogtreecommitdiffhomepage
path: root/middleware
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 /middleware
parente555accb612e189ab9bdad403958d4e0a6d809ae (diff)
Just use hardcoded strings
Diffstat (limited to 'middleware')
-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{