Messages

play.api.i18n.Messages
See theMessages companion object
trait Messages extends MessagesProvider

A messages returns string messages using a chosen language.

This is commonly backed by a MessagesImpl case class, but does extend Product and does not expose MessagesApi as part of its interface.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class MessagesImpl

Members list

Value members

Abstract methods

def apply(key: String, args: Any*): String

Translates a message.

Translates a message.

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

Value parameters

args

the message arguments

key

the message key

Attributes

Returns

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

def apply(keys: Seq[String], args: Any*): String

Translates the first defined message.

Translates the first defined message.

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

Value parameters

args

the message arguments

keys

the message key

Attributes

Returns

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

def asJava: Messages

Attributes

Returns

the Java version for this Messages.

Check if a message key is defined.

Check if a message key is defined.

Value parameters

key

the message key

Attributes

Returns

a boolean

def lang: Lang

Returns the language associated with the messages.

Returns the language associated with the messages.

Attributes

Returns

the selected language.

def translate(key: String, args: Seq[Any]): Option[String]

Translates a message.

Translates a message.

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

Value parameters

args

the message arguments

key

the message key

Attributes

Returns

the formatted message, if this key was defined

Concrete methods

Every Messages is also a MessagesProvider.

Every Messages is also a MessagesProvider.

Attributes

Returns

the messages itself.