@@ -16,6 +16,7 @@ import lila.notify.Notification.Notifies
16
16
import lila .oauth .{ OAuthScope , OAuthServer }
17
17
import lila .security .{ FingerHash , FingerPrintedUser , Granter , Permission }
18
18
import lila .user .{ UserContext , User => UserModel }
19
+ import lila .i18n .I18nLangPicker
19
20
20
21
abstract private [controllers] class LilaController (val env : Env )
21
22
extends BaseController
@@ -56,6 +57,7 @@ abstract private[controllers] class LilaController(val env: Env)
56
57
implicit def ctxLang (implicit ctx : Context ) = ctx.lang
57
58
implicit def ctxReq (implicit ctx : Context ) = ctx.req
58
59
implicit def reqConfig (implicit req : RequestHeader ) = ui.EmbedConfig (req)
60
+ def reqLang (implicit req : RequestHeader ) = I18nLangPicker (req)
59
61
60
62
protected def EnableSharedArrayBuffer (res : Result ): Result = res.withHeaders(
61
63
" Cross-Origin-Opener-Policy" -> " same-origin" ,
@@ -471,7 +473,7 @@ abstract private[controllers] class LilaController(val env: Env)
471
473
}
472
474
473
475
private def getAndSaveLang (req : RequestHeader , user : Option [UserModel ]): Lang = {
474
- val lang = lila.i18n. I18nLangPicker (req, user.flatMap(_.lang))
476
+ val lang = I18nLangPicker (req, user.flatMap(_.lang))
475
477
user.filter(_.lang.fold(true )(_ != lang.code)) foreach { env.user.repo.setLang(_, lang) }
476
478
lang
477
479
}
@@ -616,7 +618,7 @@ abstract private[controllers] class LilaController(val env: Env)
616
618
jsonFormError(err)(lila.i18n.defaultLang)
617
619
618
620
protected def jsonFormErrorFor (err : Form [_], req : RequestHeader , user : Option [UserModel ]) =
619
- jsonFormError(err)(lila.i18n. I18nLangPicker (req, user.flatMap(_.lang)))
621
+ jsonFormError(err)(I18nLangPicker (req, user.flatMap(_.lang)))
620
622
621
623
protected def pageHit (req : RequestHeader ): Unit =
622
624
if (HTTPRequest isHuman req) lila.mon.http.path(req.path).increment()
0 commit comments