summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-08-08 12:26:19 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-08-08 16:49:08 +0200
commit18f6fa052e107219c5d367234fa3d5d65b2a5246 (patch)
tree87c506f631d2d6248123e805ea6534f3acbf4837
parent59f75e8303805e20727f539912a25e138a20c2c7 (diff)
Set the theme before doing i18n
During i18n printer resolution, if there is no locale cookie we render the language selection screen. When this screen is rendered it will grab the users theme from the current context. As a result of not having added the theme to the context yet though, we get a panic. To mitigate this we set the theme before doing any internationalization.
-rw-r--r--main.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/main.go b/main.go
index c30d46b..c1ad359 100644
--- a/main.go
+++ b/main.go
@@ -34,8 +34,8 @@ func main() {
mux.Handle("GET /favicon.ico", fs)
mux.Handle("GET /style.css", fs)
mux.Handle("GET /", middleware.Pipe(
- middleware.I18n,
middleware.Theme,
+ middleware.I18n,
)(http.HandlerFunc(finalHandler)))
mux.Handle("POST /language", http.HandlerFunc(setUserLanguage))