Community contributed extensions

@messages

Module messages provides a web based tool for managing your application’s localizations. You need to enable the messages module in the conf/application.conf file

module.messages=${play.path}/modules/messages-{version}

And next you will need to add the following line to the conf/routes file

*     /    module:messages

Then you can access the tool at http://localhost:9000/@messages.

New in version 1.0

- New, pimped UI with Ajax

Message keys lookup

The tool will use simple regexp to look for localization keys in the application sources. The default path used is app, but this can be configured with a property.

The lookup will work in most cases, but it cannot of course find generated localization keys. For example consider the following code

UserType type = UserType.ADMIN;
String localizedString = Messages.get("user.type." + userType.name().toLowerCase());

In this case the tool will find the first part of the key user.type. when the valid key would be user.type.admin. To help you with this special, but common case @messages has support for ignore and **keep* lists.

Ignore list

Ignore list is intended for those keys that the tool finds from the sources that are invalid for some reason, like the user.type. in our example. To add the key to the ignore list you need to check the ignore checkbox when the key shows up in the new keys. Ignored keys can be found under the ignored keys link in the new keys tab.

Keep list

Keep list is intended for those keys that the tool cannot find from the sources, like the user.type.admin in our example. To add the key to the keep list you need to check the keep checkbox if the key shows up in the obsolete keys tab. New keys added with the tool will have the keep checkbox checked by default.

A key in the keep list can be found in the new keys or existing keys tab, depending on whether it has been localized for the selected language or not.

Configuration reference

messages.srcDir, default app: A comma separated list of paths the tool uses when it looks for localization keys in the sources.
messages.targetDir, default conf: Path to the directory where the tool will read and write the messages files.
messages.resource, default DefaultMessageResource: Class which is used to load and save the localizations.