implicit class ResultWithMessagesApi extends AnyRef

Adds convenient methods to handle the client-side language

Source
I18nSupport.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ResultWithMessagesApi
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new ResultWithMessagesApi(result: Result)

Value Members

  1. def withLang(lang: Lang)(implicit messagesApi: MessagesApi): 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 messagesApi: MessagesApi = ...
    val lang = Lang("fr-FR")
    Ok(Messages("hello.world")).withLang(lang)
    lang

    the language to store for the user

    returns

    the new result

  2. def withoutLang(implicit messagesApi: MessagesApi): Result

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

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

    For example:

    implicit val messagesApi: MessagesApi = ...
    Ok(Messages("hello.world")).withoutLang
    returns

    the new result

Deprecated Value Members

  1. def clearingLang(implicit messagesApi: MessagesApi): Result
    Annotations
    @deprecated
    Deprecated

    (Since version 2.7.0) Use withoutLang