public class MessagesImpl extends java.lang.Object implements Messages
This class serves two purposes. One is for backwards compatibility, it serves the old static API for accessing messages. The other is a new API, which carries an inject messages, and a selected language.
The methods for looking up messages on the old API are called get, on the new API, they are called at. In Play 3.0, when we remove the old API, we may alias the at methods to the get names.
Messages.Attrs
Constructor and Description |
---|
MessagesImpl(Lang lang,
MessagesApi messagesApi) |
Modifier and Type | Method and Description |
---|---|
play.api.i18n.Messages |
asScala() |
java.lang.String |
at(java.util.List<java.lang.String> keys,
java.lang.Object... args)
Get the message at the first defined key.
|
java.lang.String |
at(java.lang.String key,
java.lang.Object... args)
Get the message at the given key.
|
java.lang.Boolean |
isDefinedAt(java.lang.String key)
Check if a message key is defined.
|
Lang |
lang()
Get the lang for these messages.
|
MessagesApi |
messagesApi() |
public MessagesImpl(Lang lang, MessagesApi messagesApi)
public Lang lang()
Messages
public MessagesApi messagesApi()
public java.lang.String at(java.lang.String key, java.lang.Object... args)
Uses `java.text.MessageFormat` internally to format the message.
public java.lang.String at(java.util.List<java.lang.String> keys, java.lang.Object... args)
Uses `java.text.MessageFormat` internally to format the message.
public java.lang.Boolean isDefinedAt(java.lang.String key)
isDefinedAt
in interface Messages
key
- the message key