Localizing your Play application with @messages

I wrote this module to help me with the localization of our application. I used to have similar tool in our old struts based system, so I first copied it to play and later rewrote it all together. I even forced myself to learn regexp, which I have been trying to avoid so far ;).

Configuration

First you need to add the module to your application.conf:

module.messages=path to the module
Then you need to add the module routes to your application routes:
*    /    module:messages
Now you need to restart your application and then you can access the tool at @messages:
http://localhost:9000/@messages

Managing existing keys

This is the tab where you can modify the existing keys, keys that are found in sources and messages. Header section has selection for the language to edit and another for the language to compare to. Keys can be removed by checking the remove check box.

The keep check box is reserved for valid keys that the tool doesn't find in the sources, for example keys that are generated in code.

Localizing new keys

New keys are those keys that are found in the sources but are not yet localized in the messages file.

Since we are not sure about the first key we click on the key to check the sources. From the sources we can see that this key is in fact part of a generated key. We choose to ignore this key, meaning that it will no longer be shown in the new keys list in any language.

After save we can find the key in the ignored keys section. Ignored keys are saved in the messages.ignore file.

Checking obsolete keys

Obsolete keys are those keys that are in the messages file, but cannot be found in the sources.

We mark keys that are valid with the keep check box. These keys will be added to the keep list and will be displayed among the existing keys. The keep list is saved in messages.keep file.

Keys that are old can be removed by checking the remove check box.

Links

You can find the sources at github here https://github.com/huljas/play-messages.