Play框架:i18n + Scala

6

我想知道是否有一种方法可以在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>

}

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

1个回答

12

这是我使用的内容:

@import play.i18n._

@main(title = "The title") {

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

}
注意调用 Messages.get("...") 前面的 @ 符号。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接