aboutsummaryrefslogtreecommitdiffhomepage
path: root/http/handler/context.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-01-18 21:53:31 -0800
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-01-20 13:25:20 -0800
commitbdcc4134fa37a071d696afdcaadf21ffa5f3c323 (patch)
treef4a5d31f140713bd38c776d1f1c3aec152eaa0e8 /http/handler/context.go
parent6302c3b2194e43add648724044bb293ea15c5116 (diff)
Store language in session to show the login page translated
Diffstat (limited to 'http/handler/context.go')
-rw-r--r--http/handler/context.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/http/handler/context.go b/http/handler/context.go
index a04a816..35eb1ea 100644
--- a/http/handler/context.go
+++ b/http/handler/context.go
@@ -80,8 +80,12 @@ func (c *Context) LoggedUser() *model.User {
// UserLanguage get the locale used by the current logged user.
func (c *Context) UserLanguage() string {
- user := c.LoggedUser()
- return user.Language
+ if c.IsAuthenticated() {
+ user := c.LoggedUser()
+ return user.Language
+ }
+
+ return c.getContextStringValue(middleware.UserLanguageContextKey)
}
// Translate translates a message in the current language.
@@ -145,7 +149,6 @@ func (c *Context) getContextStringValue(key *middleware.ContextKey) string {
return v.(string)
}
- logger.Error("[Core:Context] Missing key: %s", key)
return ""
}