简体   繁体   中英

Playframework: DRY way to write I18n files

Just want to make my translation file DRY, but when I try to something like:

  parent {
     child=Child!
  }

That doesn't work also:

  parent = {
     child=Child!
  }

It falls with ProvisionException: Unable to provision, see the following errors: at play.api.i18n.DefaultMessagesApi

But this works well:

  parent.child=Child!

But it's natural if we have 2 or more children with a parent to move them into parent block.

You can now use play-i18n-hocon:

https://github.com/marcospereira/play-i18n-hocon

Keep in mind that, as stated at the docs, "this is not meant to be used as a drop-in replacement to default built-in module since Java Properties syntax is not compatible with HOCON."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM