SIBYL System

just technical blog

could not find implicit value for parameter messages: play.api.i18n.Messages

   

play_full_color

Playframework 2.4 (Scala)でviewに@inputTextを追加した時に表示されたエラー。

Multiple annotations found at this line:
– not enough arguments for method apply: (implicit handler: views.html.helper.FieldConstructor, implicit
messages: play.api.i18n.Messages)play.twirl.api.HtmlFormat.Appendable in class inputText. Unspecified value
parameter messages.
– could not find implicit value for parameter messages: play.api.i18n.Messages

どうやらviewに「(implicit messages: Messages)」を追加しないと行けない模様。こちら変更前

変更後

viewにこの設定を入れるとControllerも変更する必要がある模様。追加するのはInject, I18nSupport, MessagesApi, Messages, Langのインポートと、Controllerクラスの記述を修正。

チュートリアルページには何も書かれてなかったし、どこ漁っても日本語での対応方法書いてなかったのツライ。

以下を参考にしました。

http://www.innovaedge.com/2015/06/18/adding-internationalization-to-a-scalaplayframework-2-4-application/

 

 - Playframework(Scala) ,