package i18n
Contains the internationalisation API.
For example, translating a message:
val msgString = Messages("items.found", items.size)
- Source
- package.scala
- Alphabetic
- By Inheritance
- i18n
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- class DefaultLangs extends Langs
- Annotations
- @Singleton()
- class DefaultLangsProvider extends Provider[Langs]
- Annotations
- @Singleton()
- class DefaultMessagesApi extends MessagesApi
The Messages API.
The Messages API.
- Annotations
- @Singleton()
- class DefaultMessagesApiProvider extends Provider[MessagesApi]
- Annotations
- @Singleton()
- trait I18NSupportLowPriorityImplicits extends AnyRef
Implicit conversions for using i18n with requests and results.
- trait I18nComponents extends AnyRef
Injection helper for i18n components
- class I18nModule extends Module
- trait I18nSupport extends I18NSupportLowPriorityImplicits
Brings convenient implicit conversions from play.api.mvc.RequestHeader to Messages.
Brings convenient implicit conversions from play.api.mvc.RequestHeader to Messages.
Example:
import play.api.i18n.Messages class MyController(val messagesApi: MessagesApi ...) extends AbstractController(cc) with I18nSupport { val action = Action { implicit request => val messageFromRequest = request.messages("hello.world") Ok(s"$messageFromRequest") } }
- case class Lang(locale: Locale) extends Product with Serializable
A Lang supported by the application.
- trait LangImplicits extends AnyRef
A trait for extracting a Messages instance from Langs
- trait Langs extends AnyRef
Manages languages in Play
- trait Messages extends MessagesProvider
A messages returns string messages using a chosen language.
A messages returns string messages using a chosen language.
This is commonly backed by a MessagesImpl case class, but does extend Product and does not expose MessagesApi as part of its interface.
- Annotations
- @implicitNotFound("An implicit Messages instance was not found. Please see https://www.playframework.com/documentation/latest/ScalaI18N")
- trait MessagesApi extends AnyRef
The internationalisation API.
- case class MessagesImpl(lang: Lang, messagesApi: MessagesApi) extends Messages with Product with Serializable
Provides messages for a particular language.
Provides messages for a particular language.
This intended for use to carry both the messages and the current language, particularly useful in templates so that both can be captured by one parameter.
- lang
The lang (context)
- messagesApi
The messages API
- trait MessagesImplicits extends AnyRef
- trait MessagesProvider extends AnyRef
This trait is used to indicate when a Messages instance can be produced.
This trait is used to indicate when a Messages instance can be produced.
- Annotations
- @implicitNotFound("An implicit MessagesProvider instance was not found. Please see https://www.playframework.com/documentation/latest/ScalaForms#Passing-MessagesProvider-to-Form-Helpers")
Value Members
- object I18nSupport extends I18NSupportLowPriorityImplicits
A static object with type enrichment for request and responses.
A static object with type enrichment for request and responses.
import I18nSupport._
- object Lang extends Serializable
Utilities related to Lang values.
- object Messages extends MessagesImplicits
Internationalisation API.
Internationalisation API.
For example:
val msgString = Messages("items.found", items.size)