0
当我在开发模式下运行我的Play 2.6应用程序时,它已正确本地化为所需的语言。但是在生产模式下,消息的占位符不会被其实际值取代。换句话说:在生产模式下播放2.6 I18N旋转失败
在messages.en
我:
home.location = Germany
在我捻模板,我有:
@()(implicit messages: MessagesProvider)
...
<span>@messages.messages("home.location")</span>
并在控制器:
class HomeController @Inject()(components: ControllerComponents, langs: Langs)
extends AbstractController(components)
with I18nSupport {
def home: Action[AnyContent] = Action { implicit request =>
Ok(views.html.home())
}
}
当我在开发中运行模式下,它呈现为
<span>Germany</span>
但在PROD模式:
<span>home.location</span>
,当我在PROD模式SBT运行,还可以当我sbt-native-packager
打包和独立运行会出现这种情况。我是否认为它错了?
谢谢,但它没有帮助。 – Haspemulator
使用 @Messages(“home.location”)。继承并实现“MessagesAbstractController”。我是这样做的。 – terdong