@Singleton
public class MessagesApi
extends java.lang.Object
Constructor and Description |
---|
MessagesApi(play.api.i18n.MessagesApi messages) |
Modifier and Type | Method and Description |
---|---|
play.api.i18n.MessagesApi |
asScala() |
java.lang.String |
get(play.api.i18n.Lang lang,
java.util.List<java.lang.String> keys,
java.lang.Object... args)
Translates the first defined message.
|
java.lang.String |
get(play.api.i18n.Lang lang,
java.lang.String key,
java.lang.Object... args)
Translates a message.
|
java.lang.Boolean |
isDefinedAt(play.api.i18n.Lang lang,
java.lang.String key)
Check if a message key is defined.
|
boolean |
langCookieHttpOnly() |
java.lang.String |
langCookieName() |
boolean |
langCookieSecure() |
Messages |
preferred(java.util.Collection<Lang> candidates)
Get a messages context appropriate for the given candidates.
|
Messages |
preferred(Http.RequestHeader request)
Get a messages context appropriate for the given request.
|
play.api.i18n.MessagesApi |
scalaApi()
Deprecated.
As of release 2.6.0. Use
asScala() |
@Deprecated public play.api.i18n.MessagesApi scalaApi()
asScala()
public play.api.i18n.MessagesApi asScala()
public java.lang.String get(play.api.i18n.Lang lang, java.lang.String key, java.lang.Object... args)
Uses `java.text.MessageFormat` internally to format the message.
lang
- the message langkey
- the message keyargs
- the message argumentspublic java.lang.String get(play.api.i18n.Lang lang, java.util.List<java.lang.String> keys, java.lang.Object... args)
Uses `java.text.MessageFormat` internally to format the message.
lang
- the message langkeys
- the messages keysargs
- the message argumentspublic java.lang.Boolean isDefinedAt(play.api.i18n.Lang lang, java.lang.String key)
lang
- the message langkey
- the message keypublic Messages preferred(java.util.Collection<Lang> 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.
candidates
- the candidate languagespublic Messages preferred(Http.RequestHeader request)
Will select a language from the request, based on the languages available, and fallback to the default language if none of the candidates are available.
request
- the incoming requestpublic java.lang.String langCookieName()
public boolean langCookieSecure()
public boolean langCookieHttpOnly()