播放框架,子文件夹中的 i18n "messages.*"
Play framework, i18n "messages.*" in subfolders
我想将 conf/messages
放入子文件夹,例如 conf/lang/messages
。文档中没有关于此的内容:https://www.playframework.com/documentation/2.4.x/JavaI18N.
有人解决了这个问题吗?
这个Messages.scala source code有个线索:
protected val messagesPrefix =
config.getDeprecated[Option[String]]("play.i18n.path", "messages.path")
我还没有在 2.4 中尝试过,但看起来值得一试。
您可以在 application.conf
中指定子目录,方法是添加:
play.i18n.path = "lang"
这样做会告诉 Play 读取来自 conf/lang
的消息文件。
我想将 conf/messages
放入子文件夹,例如 conf/lang/messages
。文档中没有关于此的内容:https://www.playframework.com/documentation/2.4.x/JavaI18N.
有人解决了这个问题吗?
这个Messages.scala source code有个线索:
protected val messagesPrefix =
config.getDeprecated[Option[String]]("play.i18n.path", "messages.path")
我还没有在 2.4 中尝试过,但看起来值得一试。
您可以在 application.conf
中指定子目录,方法是添加:
play.i18n.path = "lang"
这样做会告诉 Play 读取来自 conf/lang
的消息文件。