@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() |
Result |
clearLang(Result result)
Given a Result, return a new Result with the lang cookie discarded.
|
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() |
java.util.Optional<Http.Cookie.SameSite> |
langCookieSameSite() |
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.
|
Result |
setLang(Result result,
Lang lang)
Given a Result and a Lang, return a new Result with the lang cookie set to the given Lang.
|
public play.api.i18n.MessagesApi asScala()
public java.lang.String get(play.api.i18n.Lang lang, java.lang.String key, java.lang.Object... args)
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)
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)
candidates
- the candidate languagespublic Messages preferred(Http.RequestHeader request)
request
- the incoming requestpublic Result setLang(Result result, Lang lang)
result
- the result where the lang will be set.lang
- the lang to set on the resultpublic Result clearLang(Result result)
result
- the result to clear the lang.public java.lang.String langCookieName()
public boolean langCookieSecure()
public boolean langCookieHttpOnly()
public java.util.Optional<Http.Cookie.SameSite> langCookieSameSite()