ResultWithLang

play.api.mvc.LegacyI18nSupport.ResultWithLang
implicit class ResultWithLang(result: Result)(implicit messagesApi: MessagesApi)

Adds convenient methods to handle the client-side language.

This class exists only for backward compatibility.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def withLang(lang: Lang): Result

Sets the user's language permanently for future requests by storing it in a cookie.

Sets the user's language permanently for future requests by storing it in a cookie.

For example:

implicit val lang = Lang("fr-FR")
Ok(Messages("hello.world")).withLang(lang)

Value parameters

lang

the language to store for the user

Attributes

Returns

the new result

Reset the user's language by discarding the language cookie set by withLang

Reset the user's language by discarding the language cookie set by withLang

For example:

Ok(Messages("hello.world")).withoutLang

Attributes

Returns

the new result

Deprecated methods

Attributes

Deprecated
true