Packages

c

play.api.i18n

DefaultMessagesApi

class DefaultMessagesApi extends MessagesApi

The Messages API.

Annotations
@Singleton()
Source
Messages.scala
Linear Supertypes
MessagesApi, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DefaultMessagesApi
  2. MessagesApi
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new DefaultMessagesApi(messages: Map[String, Map[String, String]])
  2. new DefaultMessagesApi(javaMessages: Map[String, Map[String, String]], langs: i18n.Langs)
  3. new DefaultMessagesApi(messages: Map[String, Map[String, String]] = Map.empty, langs: Langs = new DefaultLangs(), langCookieName: String = "PLAY_LANG", langCookieSecure: Boolean = false, langCookieHttpOnly: Boolean = false, langCookieSameSite: Option[SameSite] = None, httpConfiguration: HttpConfiguration = HttpConfiguration(), langCookieMaxAge: Option[Int] = None)
    Annotations
    @Inject()

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply(keys: Seq[String], args: Any*)(implicit lang: Lang): String

    Translates the first defined message.

    Translates the first defined message.

    Uses java.text.MessageFormat internally to format the message.

    keys

    the message key

    args

    the message arguments

    returns

    the formatted message or a default rendering if the key wasn’t defined

    Definition Classes
    DefaultMessagesApiMessagesApi
  5. def apply(key: String, args: Any*)(implicit lang: Lang): String

    Translates a message.

    Translates a message.

    Uses java.text.MessageFormat internally to format the message.

    key

    the message key

    args

    the message arguments

    returns

    the formatted message or a default rendering if the key wasn’t defined

    Definition Classes
    DefaultMessagesApiMessagesApi
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def asJava: i18n.MessagesApi

    returns

    The Java version for Messages API.

    Definition Classes
    MessagesApi
  8. def clearLang(result: Result): Result

    Given a Result, return a new Result with the lang cookie discarded.

    Given a Result, return a new Result with the lang cookie discarded.

    Definition Classes
    DefaultMessagesApiMessagesApi
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. val httpConfiguration: HttpConfiguration
  16. def isDefinedAt(key: String)(implicit lang: Lang): Boolean

    Check if a message key is defined.

    Check if a message key is defined.

    key

    the message key

    returns

    a boolean

    Definition Classes
    DefaultMessagesApiMessagesApi
  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. val langCookieHttpOnly: Boolean

    Whether the HTTP only attribute of the cookie should be set to true or not.

    Whether the HTTP only attribute of the cookie should be set to true or not.

    Definition Classes
    DefaultMessagesApiMessagesApi
  19. val langCookieMaxAge: Option[Int]

    An optional max age in seconds for the language Cookie.

    An optional max age in seconds for the language Cookie.

    Definition Classes
    DefaultMessagesApiMessagesApi
  20. val langCookieName: String

    Name for the language Cookie.

    Name for the language Cookie.

    Definition Classes
    DefaultMessagesApiMessagesApi
  21. val langCookieSameSite: Option[SameSite]

    The value of the SameSite attribute of the cookie.

    The value of the SameSite attribute of the cookie. If None, then no SameSite attribute is set.

    Definition Classes
    DefaultMessagesApiMessagesApi
  22. val langCookieSecure: Boolean

    Whether the secure attribute of the cookie is true or not.

    Whether the secure attribute of the cookie is true or not.

    Definition Classes
    DefaultMessagesApiMessagesApi
  23. val messages: Map[String, Map[String, String]]

    Get all the defined messages

    Get all the defined messages

    Definition Classes
    DefaultMessagesApiMessagesApi
  24. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. def noMatch(key: String, args: Seq[Any])(implicit lang: Lang): String
    Attributes
    protected
  26. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  27. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  28. def preferred(request: RequestHeader): Messages

    Get the preferred messages for the given request

    Get the preferred messages for the given request

    Definition Classes
    DefaultMessagesApiMessagesApi
  29. def preferred(request: RequestHeader): Messages

    Get the preferred messages for the given Java request

    Get the preferred messages for the given Java request

    Definition Classes
    DefaultMessagesApiMessagesApi
  30. def preferred(candidates: Seq[Lang]): Messages

    Get the preferred messages for the given candidates.

    Get the preferred messages for the given candidates.

    Will select a language from the candidates, based on the languages available, and fallback to the default language if none of the candidates are available.

    Definition Classes
    DefaultMessagesApiMessagesApi
  31. def setLang(result: Result, lang: Lang): Result

    Given a Result and a Lang, return a new Result with the lang cookie set to the given Lang.

    Given a Result and a Lang, return a new Result with the lang cookie set to the given Lang.

    Definition Classes
    DefaultMessagesApiMessagesApi
  32. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  33. def toString(): String
    Definition Classes
    AnyRef → Any
  34. def translate(key: String, args: Seq[Any])(implicit lang: Lang): Option[String]

    Translates a message.

    Translates a message.

    Uses java.text.MessageFormat internally to format the message.

    key

    the message key

    args

    the message arguments

    returns

    the formatted message, if this key was defined

    Definition Classes
    DefaultMessagesApiMessagesApi
  35. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  36. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  37. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from MessagesApi

Inherited from AnyRef

Inherited from Any

Ungrouped