mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Store language in session to show the login page translated
This commit is contained in:
parent
6302c3b219
commit
bdcc4134fa
7 changed files with 30 additions and 9 deletions
|
@ -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 ""
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue