playframework:i18n + scala

Roc*_*och 6 templates scala internationalization playframework

我想知道是否有一种方法可以在scala/playframework中使用i18n,这是我到目前为止尝试过的方法:

@()(

    implicit

    params:play.mvc.Scope.Params,

    flash:play.mvc.Scope.Flash,

    errors:Map[String,play.data.validation.Error]

)

@import play.i18n.Messages

@main(title = "The title") {

    <p>Hello world in &{'english'}</p>

}
Run Code Online (Sandbox Code Playgroud)

我也尝试使用Message.get(...)而不是&{...},但它没有帮助

小智 12

这是我用的:

@import play.i18n._

@main(title = "The title") {

   <p>Hello world in @Messages.get("english")</p>

}
Run Code Online (Sandbox Code Playgroud)

在调用Messages.get("...")之前注意@.