Reputation: 2401
Kindly correct and elaborate if my understanding is wrong. Messages class is loaded at the startup of play application and Messages file ,as per default locale, is read and stored as key value pair which we can access using get() method.
Thanks
Upvotes: 0
Views: 130
Reputation: 11479
Yes, this is correct. The Java Messages API essentially just calls the Scala API. So Messages.get("key") in the Java API calls Messages.apply("key") in the Scala API.
The actual data does not live in Messages though, instead it is implemented as a play plugin play.api.MessagesPlugin which is initialized on app start. The plugin will load the message file of each language that you have specified with the configuration key application.langs in 'conf/application.conf'.
Upvotes: 1