本文整理汇总了Scala中play.api.i18n.I18nComponents类的典型用法代码示例。如果您正苦于以下问题:Scala I18nComponents类的具体用法?Scala I18nComponents怎么用?Scala I18nComponents使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了I18nComponents类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: MyApplicationLoader
//设置package包名称以及导入依赖的类
import dao.CroissantDAO
import jobs.GmailJob
import play.api._
import play.api.ApplicationLoader.Context
import router.Routes
import play.api.libs.ws.ahc.AhcWSComponents
import play.api.libs.mailer._
import play.api.i18n.I18nComponents
import play.modules.reactivemongo.{ReactiveMongoApiFromContext, ReactiveMongoComponents}
import services.OauthProvider
import utils.{Mailer, Settings}
class MyApplicationLoader extends ApplicationLoader {
def load(context: Context) = {
LoggerConfigurator(context.environment.classLoader).foreach(_.configure(context.environment))
new MyComponents(context).application
}
}
class MyComponents(context: Context) extends ReactiveMongoApiFromContext(context)
with I18nComponents
with AhcWSComponents
with MailerComponents
with ReactiveMongoComponents {
implicit val ec = actorSystem.dispatcher
val settings = new Settings(configuration)
val mailer = new Mailer(settings, mailerClient)
val croissantDAO = new CroissantDAO(settings, mailer, reactiveMongoApi)
val oauthProvider = new OauthProvider(settings, wsClient)
//val gmailJob = new GmailJob(wsClient, actorSystem, settings, mailer, croissantDAO)
lazy val router = new Routes(
httpErrorHandler,
new controllers.CroissantController(settings, messagesApi, mailer, croissantDAO),
new controllers.AdminCroissantController(settings, messagesApi, mailer, croissantDAO),
new controllers.OauthController(oauthProvider),
new controllers.Assets(httpErrorHandler)
)
}
示例2: WebGateway
//设置package包名称以及导入依赖的类
import com.lightbend.lagom.scaladsl.api.{ServiceAcl, ServiceInfo}
import com.lightbend.lagom.scaladsl.client.LagomServiceClientComponents
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import com.softwaremill.macwire._
import controllers.{Assets, Main}
import ogr.wex.cmsfs.monitor.api.MonitorService
import org.wex.cmsfs.lagom.service.discovery.Common
import org.wex.cmsfs.lagom.service.discovery.consul.ConsulServiceLocatorComponents
import play.api.ApplicationLoader.Context
import play.api.i18n.I18nComponents
import play.api.libs.ws.ahc.AhcWSComponents
import play.api.{ApplicationLoader, BuiltInComponentsFromContext, Mode}
import router.Routes
import scala.collection.immutable
import scala.concurrent.ExecutionContext
abstract class WebGateway(context: Context) extends BuiltInComponentsFromContext(context)
with I18nComponents
with AhcWSComponents
with LagomServiceClientComponents {
override lazy val serviceInfo: ServiceInfo = ServiceInfo(
"web-gateway",
Map(
"web-gateway" -> immutable.Seq(ServiceAcl.forPathRegex("(?!/api/).*"))
)
)
override implicit lazy val executionContext: ExecutionContext = actorSystem.dispatcher
override lazy val router = {
val prefix = "/"
wire[Routes]
}
lazy val monitorService = serviceClient.implement[MonitorService]
lazy val main = wire[Main]
lazy val assets = wire[Assets]
}
class WebGatewayLoader extends ApplicationLoader {
override def load(context: Context) = {
Common.loaderEnvironment(context)
println(context.environment.mode)
context.environment.mode match {
case Mode.Dev =>
new WebGateway(context) with LagomDevModeComponents {}.application
case _ =>
new WebGateway(context) with ConsulServiceLocatorComponents {}.application
}
}
}
示例3: WebGateway
//设置package包名称以及导入依赖的类
import com.example.auction.bidding.api.BiddingService
import com.example.auction.item.api.ItemService
import com.example.auction.user.api.UserService
import com.lightbend.lagom.scaladsl.api.{ ServiceAcl, ServiceInfo }
import com.lightbend.lagom.scaladsl.client.LagomServiceClientComponents
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import com.softwaremill.macwire._
import com.typesafe.conductr.bundlelib.lagom.scaladsl.ConductRApplicationComponents
import controllers.{ Assets, ItemController, Main, ProfileController }
import play.api.ApplicationLoader.Context
import play.api.i18n.I18nComponents
import play.api.libs.ws.ahc.AhcWSComponents
import play.api.{ ApplicationLoader, BuiltInComponentsFromContext, Mode }
import router.Routes
import scala.collection.immutable
import scala.concurrent.ExecutionContext
abstract class WebGateway(context: Context) extends BuiltInComponentsFromContext(context)
with I18nComponents
with AhcWSComponents
with LagomServiceClientComponents {
override lazy val serviceInfo: ServiceInfo = ServiceInfo(
"web-gateway",
Map(
"web-gateway" -> immutable.Seq(ServiceAcl.forPathRegex("(?!/api/).*"))
)
)
override implicit lazy val executionContext: ExecutionContext = actorSystem.dispatcher
override lazy val router = {
val prefix = "/"
wire[Routes]
}
lazy val userService = serviceClient.implement[UserService]
lazy val itemService = serviceClient.implement[ItemService]
lazy val biddingService = serviceClient.implement[BiddingService]
lazy val main = wire[Main]
lazy val itemController = wire[ItemController]
lazy val profileController = wire[ProfileController]
lazy val assets = wire[Assets]
}
class WebGatewayLoader extends ApplicationLoader {
override def load(context: Context) = context.environment.mode match {
case Mode.Dev =>
(new WebGateway(context) with LagomDevModeComponents).application
case _ =>
(new WebGateway(context) with ConductRApplicationComponents).application
}
}
示例4: WebGateway
//设置package包名称以及导入依赖的类
import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.api.{ServiceAcl, ServiceInfo}
import com.lightbend.lagom.scaladsl.client.LagomServiceClientComponents
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import play.api.ApplicationLoader.Context
import play.api.{ApplicationLoader, BuiltInComponentsFromContext, Mode}
import play.api.i18n.I18nComponents
import play.api.libs.ws.ahc.AhcWSComponents
import router.Routes
import com.softwaremill.macwire._
import controllers.Assets
import uk.co.turingatemyhamster.shoppinglist.user.api.UserService
import scala.collection.immutable
import scala.concurrent.ExecutionContext
abstract class WebGateway(context: Context) extends BuiltInComponentsFromContext(context)
with I18nComponents
with AhcWSComponents
with LagomServiceClientComponents
{
override lazy val serviceInfo: ServiceInfo = ServiceInfo(
"web-ui",
Map(
"web-ui" -> immutable.Seq(ServiceAcl.forPathRegex("(?!/api/).*"))
)
)
override implicit lazy val executionContext: ExecutionContext = actorSystem.dispatcher
protected implicit lazy val playConfig = context.initialConfiguration
protected implicit lazy val playEnv = context.environment
override lazy val router: Routes = {
val prefix = "/"
wire[Routes]
}
lazy val userService = serviceClient.implement[UserService]
lazy val cApplication: controllers.Application = wire[controllers.Application]
lazy val assets: Assets = wire[Assets]
}
class WebGatewayLoader extends ApplicationLoader {
override def load(context: Context) = context.environment.mode match {
case Mode.Dev =>
new WebGateway(context) with LagomDevModeComponents {}.application
case _ =>
new WebGateway(context) {
override def serviceLocator = NoServiceLocator
}.application
}
}
示例5: SilhouetteMacwireApplicationLoader
//设置package包名称以及导入依赖的类
package com.github.jacobono
import _root_.controllers.Assets
import _root_.controllers.WebJarAssets
import com.softwaremill.macwire._
import org.flywaydb.play.FlywayPlayComponents
import play.api._
import play.api.ApplicationLoader.Context
import play.api.cache.EhCacheComponents
import play.api.db.slick.SlickComponents
import play.api.i18n.I18nComponents
import play.api.libs.openid.OpenIDComponents
import play.api.libs.ws.ning.NingWSComponents
import play.api.mvc.EssentialFilter
import play.api.routing.Router
import play.filters.csrf.CSRFComponents
import play.filters.headers.SecurityHeadersComponents
import router.Routes
import com.github.jacobono.modules._
class SilhouetteMacwireApplicationLoader extends ApplicationLoader {
def load(context: Context): Application = {
Logger.configure(context.environment)
new SilhouetteMacwireComponents(context).application
}
}
class SilhouetteMacwireComponents(context: Context) extends BuiltInComponentsFromContext(context)
with ControllerModule with UtilModule with UserModule with SilhouetteModule
with DAOModule with DatabaseModule
with I18nComponents with NingWSComponents with CSRFComponents with SecurityHeadersComponents
with SlickComponents with EhCacheComponents with OpenIDComponents with FlywayPlayComponents {
flywayPlayInitializer
// for the optional Router param in error handler
// if this is trying to use the Router value from BuiltInComponentsFromContext
// it results in a circular dependency between the Router and the HttpErrorHandler
// the application obviously won't start if this happens
lazy val routerOption = None
override lazy val httpErrorHandler = errorHandler
override lazy val httpFilters: Seq[EssentialFilter] = filters.filters
lazy val webJarAssets: WebJarAssets = wire[WebJarAssets]
lazy val assets: Assets = wire[Assets]
lazy val router: Router = {
lazy val prefix = "/"
wire[Routes]
}
}
示例6: FakeSilhouetteMacwireComponents
//设置package包名称以及导入依赖的类
package com.github.jacobono.testkit
import controllers.{ Assets, WebJarAssets }
import play.api.BuiltInComponentsFromContext
import play.api.ApplicationLoader.Context
import play.api.cache.EhCacheComponents
import play.api.db.slick.SlickComponents
import play.api.i18n.I18nComponents
import play.api.libs.openid.OpenIDComponents
import play.api.routing.Router
import play.filters.csrf.CSRFComponents
import play.filters.headers.SecurityHeadersComponents
import router.Routes
import com.softwaremill.macwire._
import com.github.jacobono.modules._
class FakeSilhouetteMacwireComponents(context: Context) extends BuiltInComponentsFromContext(context)
with ControllerModule with UtilModule with UserModule with SilhouetteModule with DAOModule with DatabaseModule
with MockWsClient with I18nComponents with CSRFComponents with SecurityHeadersComponents
with SlickComponents with EhCacheComponents with OpenIDComponents {
lazy val routerOption = None
override lazy val httpErrorHandler: play.api.http.HttpErrorHandler = errorHandler
override lazy val httpFilters = filters.filters
lazy val webJarAssets: WebJarAssets = wire[WebJarAssets]
lazy val assets: Assets = wire[Assets]
lazy val router: Router = {
lazy val prefix = "/"
wire[Routes]
}
}
示例7: Frontend
//设置package包名称以及导入依赖的类
import be.yannickdeturck.lagomshopscala.item.api.ItemService
import be.yannickdeturck.lagomshopscala.order.api.OrderService
import com.lightbend.lagom.scaladsl.api.{ServiceAcl, ServiceInfo, ServiceLocator}
import com.lightbend.lagom.scaladsl.client.LagomServiceClientComponents
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import com.lightbend.lagom.internal.client.CircuitBreakerMetricsProviderImpl
import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.broker.kafka.LagomKafkaClientComponents
import com.softwaremill.macwire._
import controllers.{Assets, DashboardController, ItemController, OrderController}
import play.api.ApplicationLoader.Context
import play.api.i18n.I18nComponents
import play.api.libs.ws.ahc.AhcWSComponents
import play.api.{Application, ApplicationLoader, BuiltInComponentsFromContext, Mode}
import router.Routes
import scala.collection.immutable
import scala.concurrent.ExecutionContext
abstract class Frontend(context: Context) extends BuiltInComponentsFromContext(context)
with I18nComponents
with AhcWSComponents
with LagomKafkaClientComponents
with LagomServiceClientComponents {
override lazy val serviceInfo: ServiceInfo = ServiceInfo(
"frontend",
Map(
"frontend" -> immutable.Seq(ServiceAcl.forPathRegex("(?!/api/).*"))
)
)
override implicit lazy val executionContext: ExecutionContext = actorSystem.dispatcher
override lazy val router = {
val prefix = "/"
wire[Routes]
}
lazy val itemService: ItemService = serviceClient.implement[ItemService]
lazy val itemController: ItemController = wire[ItemController]
lazy val orderService: OrderService = serviceClient.implement[OrderService]
lazy val orderController: OrderController = wire[OrderController]
lazy val dashboardController: DashboardController = wire[DashboardController]
lazy val assets: Assets = wire[Assets]
}
class FrontendLoader extends ApplicationLoader {
override def load(context: Context): Application = context.environment.mode match {
case Mode.Dev =>
(new Frontend(context) with LagomDevModeComponents).application
case _ =>
new Frontend(context) {
override lazy val circuitBreakerMetricsProvider = new CircuitBreakerMetricsProviderImpl(actorSystem)
override def serviceLocator: ServiceLocator = NoServiceLocator
}.application
}
}
示例8: WebGateway
//设置package包名称以及导入依赖的类
import com.example.counter.api.CounterService
import com.lightbend.lagom.scaladsl.api.{ServiceAcl, ServiceInfo}
import com.lightbend.lagom.scaladsl.client.LagomServiceClientComponents
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import play.api.{ApplicationLoader, BuiltInComponentsFromContext, Mode}
import play.api.ApplicationLoader.Context
import play.api.i18n.{I18nComponents, MessagesApi}
import play.api.libs.ws.ahc.AhcWSComponents
import com.softwaremill.macwire._
import controllers.{CounterController, HomeController}
import router.Routes
import scala.collection.immutable
import scala.concurrent.ExecutionContext
abstract class WebGateway(context: Context) extends BuiltInComponentsFromContext(context)
with I18nComponents with AhcWSComponents with LagomServiceClientComponents {
override lazy val serviceInfo = ServiceInfo(
"front-end",
Map("front-end" -> immutable.Seq(ServiceAcl.forPathRegex("(?!/api/).*")))
)
override implicit lazy val executionContext: ExecutionContext = actorSystem.dispatcher
implicit lazy val message: MessagesApi = messagesApi
override lazy val router = {
val prefix = "/"
wire[Routes]
}
lazy val counterService = serviceClient.implement[CounterService]
lazy val home = wire[HomeController]
lazy val counter = wire[CounterController]
}
class WebGatewayLoader extends ApplicationLoader {
override def load(context: Context) = context.environment.mode match {
case Mode.Dev => (new WebGateway(context) with LagomDevModeComponents).application
case _ => throw new Exception("Not ready for deployment yet.")
}
}
示例9: WebGateway
//设置package包名称以及导入依赖的类
import javax.inject.Inject
import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.api.{ServiceAcl, ServiceInfo}
import com.lightbend.lagom.scaladsl.client.LagomServiceClientComponents
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import com.softwaremill.macwire._
import controllers.{Assets, HelloController, Main}
import play.api.ApplicationLoader.Context
import play.api.i18n.I18nComponents
import play.api.libs.ws.ahc.AhcWSComponents
import play.api._
import sample.helloworld.api.HelloService
import play.api.Play.current
import play.api.i18n.Messages.Implicits._
import sample.helloworldconsumer.api.HelloConsumerService
import router.Routes
import scala.collection.immutable
import scala.concurrent.ExecutionContext
abstract class WebGateway @Inject()(context: Context) extends BuiltInComponentsFromContext(context)
with I18nComponents
with AhcWSComponents
with LagomServiceClientComponents {
override lazy val serviceInfo: ServiceInfo = ServiceInfo(
"web-gateway",
Map(
"web-gateway" -> immutable.Seq(ServiceAcl.forPathRegex("(?!/api/).*"))
)
)
override implicit lazy val executionContext: ExecutionContext = actorSystem.dispatcher
override lazy val router = {
val prefix = "/"
wire[Routes]
}
lazy val helloService = serviceClient.implement[HelloService]
lazy val helloConsumerService = serviceClient.implement[HelloConsumerService]
lazy val main = wire[Main]
lazy val helloController = wire[HelloController]
lazy val assets = wire[Assets]
}
class WebGatewayLoader extends ApplicationLoader {
override def load(context: Context): Application = context.environment.mode match {
case Mode.Dev =>
new WebGateway(context) with LagomDevModeComponents {}.application
case _ =>
new WebGateway(context) {
override def serviceLocator = NoServiceLocator
}.application
}
}
示例10: WebGateway
//设置package包名称以及导入依赖的类
import io.namelos.journal.api.JournalService
import com.lightbend.lagom.scaladsl.api.{ServiceAcl, ServiceInfo}
import com.lightbend.lagom.scaladsl.client.LagomServiceClientComponents
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import play.api.{ApplicationLoader, BuiltInComponentsFromContext, Mode}
import play.api.ApplicationLoader.Context
import play.api.i18n.{I18nComponents, MessagesApi}
import play.api.libs.ws.ahc.AhcWSComponents
import com.softwaremill.macwire._
import controllers.{CounterController, HomeController}
import router.Routes
import scala.collection.immutable
import scala.concurrent.ExecutionContext
abstract class WebGateway(context: Context) extends BuiltInComponentsFromContext(context)
with I18nComponents with AhcWSComponents with LagomServiceClientComponents {
override lazy val serviceInfo = ServiceInfo(
"front-end",
Map("front-end" -> immutable.Seq(ServiceAcl.forPathRegex("(?!/api/).*")))
)
override implicit lazy val executionContext: ExecutionContext = actorSystem.dispatcher
implicit lazy val message: MessagesApi = messagesApi
override lazy val router = {
val prefix = "/"
wire[Routes]
}
lazy val journalService = serviceClient.implement[JournalService]
lazy val home = wire[HomeController]
lazy val counter = wire[CounterController]
}
class WebGatewayLoader extends ApplicationLoader {
override def load(context: Context) = context.environment.mode match {
case Mode.Dev => (new WebGateway(context) with LagomDevModeComponents).application
case _ => throw new Exception("Not ready for deployment yet.")
}
}
示例11: WebGateway
//设置package包名称以及导入依赖的类
import com.example.auction.bidding.api.BiddingService
import com.example.auction.item.api.ItemService
import com.example.auction.user.api.UserService
import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.api.{ServiceAcl, ServiceInfo}
import com.lightbend.lagom.scaladsl.client.LagomServiceClientComponents
import com.lightbend.lagom.scaladsl.server.LagomDevModeComponents
import play.api.{ApplicationLoader, BuiltInComponentsFromContext, Mode}
import play.api.ApplicationLoader.Context
import play.api.i18n.I18nComponents
import play.api.libs.ws.ahc.AhcWSComponents
import com.softwaremill.macwire._
import controllers.{Assets, ItemController, Main, ProfileController}
import router.Routes
import scala.collection.immutable
import scala.concurrent.ExecutionContext
abstract class WebGateway(context: Context) extends BuiltInComponentsFromContext(context)
with I18nComponents
with AhcWSComponents
with LagomServiceClientComponents {
override lazy val serviceInfo: ServiceInfo = ServiceInfo(
"web-gateway",
Map(
"web-gateway" -> immutable.Seq(ServiceAcl.forPathRegex("(?!/api/).*"))
)
)
override implicit lazy val executionContext: ExecutionContext = actorSystem.dispatcher
override lazy val router = {
val prefix = "/"
wire[Routes]
}
lazy val userService = serviceClient.implement[UserService]
lazy val itemService = serviceClient.implement[ItemService]
lazy val biddingService = serviceClient.implement[BiddingService]
lazy val main = wire[Main]
lazy val itemController = wire[ItemController]
lazy val profileController = wire[ProfileController]
lazy val assets = wire[Assets]
}
class WebGatewayLoader extends ApplicationLoader {
override def load(context: Context) = context.environment.mode match {
case Mode.Dev =>
new WebGateway(context) with LagomDevModeComponents {}.application
case _ =>
new WebGateway(context) {
override def serviceLocator = NoServiceLocator
}.application
}
}
示例12: WebGateway
//设置package包名称以及导入依赖的类
import com.example.auction.user.api.UserService
import com.lightbend.lagom.scaladsl.api.{ ServiceAcl, ServiceInfo }
import com.lightbend.lagom.scaladsl.client.LagomServiceClientComponents
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import com.softwaremill.macwire._
import com.typesafe.conductr.bundlelib.lagom.scaladsl.ConductRApplicationComponents
import controllers.{ Assets, Main }
import play.api.ApplicationLoader.Context
import play.api.i18n.I18nComponents
import play.api.libs.ws.ahc.AhcWSComponents
import play.api.{ ApplicationLoader, BuiltInComponentsFromContext, Mode }
import router.Routes
import scala.collection.immutable
import scala.concurrent.ExecutionContext
abstract class WebGateway(context: Context) extends BuiltInComponentsFromContext(context)
with I18nComponents
with AhcWSComponents
with LagomServiceClientComponents {
override lazy val serviceInfo: ServiceInfo = ServiceInfo(
"web-gateway",
Map(
"web-gateway" -> immutable.Seq(ServiceAcl.forPathRegex("(?!/api/).*"))
)
)
override implicit lazy val executionContext: ExecutionContext = actorSystem.dispatcher
override lazy val router = {
val prefix = "/"
wire[Routes]
}
lazy val userService = serviceClient.implement[UserService]
lazy val main = wire[Main]
lazy val assets = wire[Assets]
}
class WebGatewayLoader extends ApplicationLoader {
override def load(context: Context) = context.environment.mode match {
case Mode.Dev =>
(new WebGateway(context) with LagomDevModeComponents).application
case _ =>
(new WebGateway(context) with ConductRApplicationComponents).application
}
}