Packages

  • package root
    Definition Classes
    root
  • package play

    Play framework.

    Play framework.

    Play

    http://www.playframework.com

    Definition Classes
    root
  • package api

    Contains the public API for Scala developers.

    Contains the public API for Scala developers.

    Read configuration
    val poolSize = configuration.getInt("engine.pool.size")
    Use the logger
    Logger.info("Hello!")
    Define a Plugin
    class MyPlugin(app: Application) extends Plugin
    Create adhoc applications (for testing)
    val application = Application(new File("."), this.getClass.getClassloader, None, Play.Mode.DEV)
    Definition Classes
    play
  • package cache

    Contains the Cache access API.

    Contains the Cache access API.

    Definition Classes
    api
  • package cluster
    Definition Classes
    api
  • package controllers
    Definition Classes
    api
  • package data

    Contains data manipulation helpers (typically HTTP form handling)

    Contains data manipulation helpers (typically HTTP form handling)

    import play.api.data._
    import play.api.data.Forms._
    
    val taskForm = Form(
      tuple(
        "name" -> text(minLength = 3),
        "dueDate" -> date("yyyy-MM-dd"),
        "done" -> boolean
      )
    )
    Definition Classes
    api
  • package db

    Contains the JDBC database access API.

    Contains the JDBC database access API.

    Example, retrieving a connection from the 'customers' datasource:

    val conn = db.getConnection("customers")
    Definition Classes
    api
  • package http

    Contains standard HTTP constants.

    Contains standard HTTP constants. For example:

    val text = ContentTypes.TEXT
    val ok = Status.OK
    val accept = HeaderNames.ACCEPT
    Definition Classes
    api
  • package i18n

    Contains the internationalisation API.

    Contains the internationalisation API.

    For example, translating a message:

    val msgString = Messages("items.found", items.size)
    Definition Classes
    api
  • DefaultLangs
  • DefaultLangsProvider
  • DefaultMessagesApi
  • DefaultMessagesApiProvider
  • I18NSupportLowPriorityImplicits
  • I18nComponents
  • I18nModule
  • I18nSupport
  • Lang
  • LangImplicits
  • Langs
  • Messages
  • MessagesApi
  • MessagesImpl
  • MessagesImplicits
  • MessagesProvider
  • package inject

    Play's runtime dependency injection abstraction.

    Play's runtime dependency injection abstraction.

    Play's runtime dependency injection support is built on JSR-330, which provides a specification for declaring how dependencies get wired to components. JSR-330 however does not address how components are provided to or located by a DI container. Play's API seeks to address this in a DI container agnostic way.

    The reason for providing this abstraction is so that Play, the modules it provides, and third party modules can all express their bindings in a way that is not specific to any one DI container.

    Components are bound in the DI container. Each binding is identified by a BindingKey, which is typically an interface that the component implements, and may be optionally qualified by a JSR-330 qualifier annotation. A binding key is bound to a BindingTarget, which describes how the implementation of the interface that the binding key represents is constructed or provided. Bindings may also be scoped using JSR-330 scope annotations.

    Bindings are provided by instances of Module.

    Out of the box, Play provides an implementation of this abstraction using Guice.

    Definition Classes
    api
    See also

    The Module class for information on how to provide bindings.

  • package internal
    Definition Classes
    api
  • package libs

    Contains various APIs that are useful while developing web applications.

    Contains various APIs that are useful while developing web applications.

    Definition Classes
    api
  • package mvc

    Contains the Controller/Action/Result API to handle HTTP requests.

    Contains the Controller/Action/Result API to handle HTTP requests.

    For example, a typical controller:

    class HomeController @Inject() (val controllerComponents: ControllerComponents) extends BaseController {
    
      def index = Action {
        Ok("It works!")
      }
    
    }
    Definition Classes
    api
  • package routing
    Definition Classes
    api
  • package templates
    Definition Classes
    api
  • package test

    Contains test helpers.

    Contains test helpers.

    Definition Classes
    api
p

play.api

i18n

package i18n

Contains the internationalisation API.

For example, translating a message:

val msgString = Messages("items.found", items.size)
Source
package.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. i18n
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class DefaultLangs extends Langs
    Annotations
    @Singleton()
  2. class DefaultLangsProvider extends Provider[Langs]
    Annotations
    @Singleton()
  3. class DefaultMessagesApi extends MessagesApi

    The Messages API.

    The Messages API.

    Annotations
    @Singleton()
  4. class DefaultMessagesApiProvider extends Provider[MessagesApi]
    Annotations
    @Singleton()
  5. trait I18NSupportLowPriorityImplicits extends AnyRef

    Implicit conversions for using i18n with requests and results.

  6. trait I18nComponents extends AnyRef

    Injection helper for i18n components

  7. class I18nModule extends Module
  8. 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")
      }
    }
  9. case class Lang(locale: Locale) extends Product with Serializable

    A Lang supported by the application.

  10. trait LangImplicits extends AnyRef

    A trait for extracting a Messages instance from Langs

  11. trait Langs extends AnyRef

    Manages languages in Play

  12. 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( ... )
  13. trait MessagesApi extends AnyRef

    The internationalisation API.

  14. 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

  15. trait MessagesImplicits extends AnyRef
  16. 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( ... )

Value Members

  1. 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._
  2. object Lang extends Serializable

    Utilities related to Lang values.

  3. object Messages extends MessagesImplicits

    Internationalisation API.

    Internationalisation API.

    For example:

    val msgString = Messages("items.found", items.size)

Inherited from AnyRef

Inherited from Any

Ungrouped