diff --git a/app/controllers/LilaController.scala b/app/controllers/LilaController.scala index 1c432a6db6..ae562f3b01 100644 --- a/app/controllers/LilaController.scala +++ b/app/controllers/LilaController.scala @@ -12,7 +12,7 @@ import scalaz.Zero import lila.app._ import lila.common.LilaCookie import lila.security.{ Permission, Granter } -import lila.user.{ Context, HeaderContext, BodyContext, User ⇒ UserModel } +import lila.user.{ Context, HeaderContext, BodyContext, UserRepo, User ⇒ UserModel } private[controllers] trait LilaController extends Controller @@ -177,7 +177,9 @@ private[controllers] trait LilaController private def restoreUser(req: RequestHeader): Fu[Option[UserModel]] = Env.security.api restoreUser req addEffect { _ foreach { user ⇒ - lila.user.UserRepo setSeenAt user.id + UserRepo setSeenAt user.id + val lang = Env.i18n.pool.lang(req).language + if (user.lang != lang.some) UserRepo.setLang(user.id, lang) Env.user setOnline user user.seenAt.isEmpty ?? Env.relation.autofollow(user) } diff --git a/app/templating/I18hHelper.scala b/app/templating/I18hHelper.scala index 50bd89537f..e753895e75 100644 --- a/app/templating/I18hHelper.scala +++ b/app/templating/I18hHelper.scala @@ -22,7 +22,8 @@ trait I18nHelper { implicit def lang(implicit ctx: Context) = pool lang ctx.req - def langName(lang: Lang) = LangList name lang.language + def langName(lang: Lang): Option[String] = langName(lang.language) + def langName(lang: String): Option[String] = LangList name lang def translationCall(implicit ctx: Context) = if (ctx.req.cookies.get(hideCallsCookieName).isDefined) None diff --git a/app/views/user/mini.scala.html b/app/views/user/mini.scala.html index cda10c1f5c..a65190e053 100644 --- a/app/views/user/mini.scala.html +++ b/app/views/user/mini.scala.html @@ -7,4 +7,9 @@ @trans.followsYou() } +@u.lang.map { l => +@langName(l).map { name => +@name +} +}