Ambiguous values ​​in Lang and requestLang

Usage: PlayFramework 2.3 and SecureSocial (2.3 compatible)

I'm getting this error in the ViewTemplate:

[error] /Users/einevea/projects/einjar/einevault/econcepts/modules/eusers/app/services.eusers/MyViewTemplates.scala:29: ambiguous implicit values:
[error]  both method request2lang in trait Controller of type (implicit request: play.api.mvc.RequestHeader)play.api.i18n.Lang
[error]  and value lang of type play.api.i18n.Lang
[error]  match expected type play.api.i18n.Lang
[error]   override def getStartSignUpPage(form: Form[String])(implicit request: RequestHeader, lang: Lang): Html = views.html.eusers.custom.startSignUp(WUPage(Messages("securesocial.signup.title")),form)(request, lang, env)

      

Any help?

+2


source to share


1 answer


The error message means you tried to invoke getStartSignUpPage

and it accepts an implicit one play.api.i18n.Lang

, but there are two implicit instances present in your scope Lang

, so the compiler doesn't know which one to choose.

The first is the lang value that you imported or defined (either as a value in the template or as an implicit parameter in the template parameter lists)



The second is a player built into one of them Controller.request2Lang

that knows how to extract Lang from the request to select the language the browser said it accepts (in the Accept-Language header).

You can get around this in a couple of ways: avoid having two instances Lang

in scope, explicitly specify parameters where you call getStartSignUpPage

, or make the implicit parameter list a regular parameter list.

+4


source







All Articles