Package play.i18n
Class MessagesImpl
- Object
-
- play.i18n.MessagesImpl
-
- All Implemented Interfaces:
play.api.i18n.MessagesProvider
,Messages
public class MessagesImpl extends Object implements Messages
This class implements the Messages interface.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface play.i18n.Messages
Messages.Attrs
-
-
Constructor Summary
Constructors Constructor Description MessagesImpl(Lang lang, MessagesApi messagesApi)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description play.api.i18n.Messages
asScala()
String
at(String key, Object... args)
Get the message at the given key.String
at(List<String> keys, Object... args)
Get the message at the first defined key.Boolean
isDefinedAt(String key)
Check if a message key is defined.Lang
lang()
Get the lang for these messages.MessagesApi
messagesApi()
-
-
-
Constructor Detail
-
MessagesImpl
public MessagesImpl(Lang lang, MessagesApi messagesApi)
-
-
Method Detail
-
lang
public Lang lang()
Description copied from interface:Messages
Get the lang for these messages.
-
messagesApi
public MessagesApi messagesApi()
- Returns:
- The underlying API
-
at
public String at(String key, Object... args)
Get the message at the given key.Uses `java.text.MessageFormat` internally to format the message.
-
at
public String at(List<String> keys, Object... args)
Get the message at the first defined key.Uses `java.text.MessageFormat` internally to format the message.
-
isDefinedAt
public Boolean isDefinedAt(String key)
Check if a message key is defined.- Specified by:
isDefinedAt
in interfaceMessages
- Parameters:
key
- the message key- Returns:
- a Boolean
-
-