Play Framework i18n Messages Hunter

Here's a little bash script to help you out hunting the different translatable labels your Play application has:



The script will search all Java, HTML and JavaScript files for the following candidates:
  • @Messages("label.my.label")
  • Messages.get("label.my.label")
  • @Required(message="label.my.label")
AFAIK this are all possible combinations for a Play application. But wait, if you're using the jquery-i18n-properties jQuery plugin the script will also detect all i18n.prop("label.my.label') entries in your JavaScript files.

The final result should be something like:

Searching for translatable strings
Matching found translatable strings with the different languages
Sorting matches
Translation label.are.you.sure missing in en
Translation label.are.you.sure missing in es
Translation label.my.label missing in en
Translation label.my.label missing in es
Looking for duplicated translations in file play/conf/messages.en
Looking for duplicated translations in file play/conf/messages.es

Finally, the script will also output the number of duplicated translations.