public class MessagesImpl extends 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() |
String |
at(List<String> keys,
Object... args)
Get the message at the first defined key.
|
String |
at(String key,
Object... args)
Get the message at the given key.
|
Boolean |
isDefinedAt(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 String at(String key, Object... args)
Uses `java.text.MessageFormat` internally to format the message.
public String at(List<String> keys, Object... args)
Uses `java.text.MessageFormat` internally to format the message.
public Boolean isDefinedAt(String key)
isDefinedAt
in interface Messages
key
- the message key