Our team have recently come up with a way to make compilation fail when an invalid key or invalid arguments are provided for Playframework’s i18n. It saves us headache when there are ~1,000 translation keys in our project. So, we would like to share it with you all.
Here’s the full blog post: https://give.engineering/2018/06/18/compilation-safety-on-playframework-i18n-with-scala-macros.html
Here’s the full working example: https://github.com/GIVESocialMovement/i18n-compilation-safety-with-macro
Here’s the Macros code: https://github.com/GIVESocialMovement/i18n-compilation-safety-with-macro/blob/master/macros/src/main/scala/givers/i18n/Translation.scala
TL;DR we use Macros to read
conf/messages and check all translation method invocations at compile time.