Software localization

3 Easy Steps to Localize Java Play Framework Projects

Localizing Java Play Framework projects can be quite tedious. Learn here how Phrase can help you translate your Play Framework app with ease!
Software localization blog category featured image | Phrase

Localizing Java Play Framework apps can be quite tedious. In this tutorial, we'll show you how Phrase can aid the translation of your Play Framework projects.

Your Basic Setup for Localizing Java Play Framework Apps

The steps to internationalization are quite easy and can be followed by the i18n guide from Typesafe.

First, add the desired languages you would want to accept to your conf/application.conf with priority from important to a less important locale:

application.langs="en,de,fr"

Add the files messages.en, messages.de, and messages.fr to your /conf folder.

Now you can start translating/localizing by consulting the official Play Documentation.

Integrate with Phrase

Using the proper format for your localization files is important. Phrase supports the Play Properties format with UTF-8 encoding and without content escaping.

Other than that it is based on the Java Properties format.

Phrase renders all downloaded files with the file extension of the locale name you use within your project (like en_US, en-GB or de). See our Format Guide.

A sample valid Play Properties file:

# My Software Project (description)

project.name=Some Name

title1=AwesomeApp

# You can never have enough titles!

more_titles Another Title

You can now easily upload the locale file to Translation Center:

Uploading the locale file to the Translation Center | Phrase

… or through our phrase gem

phrase push conf/messages.en --format=play_properties --locale=en --tag=version_1

Along the lines with “push” the usage of phrase pull is straightforward. Simply type:

phrase pull en --format=play_properties --target=conf/ --tag=version_1

The tag option is optional but always nice. With this, you have a labeling system to manage your translations in manageable chunks (like Gmail).

In this example we explicitly deal with the en locale, you can also push directories or pull all locales and their translations by not typing a locale at all.

If Ruby does not suit your needs, just use our REST-based API directly.

Next Steps

Now that your application is up to speed with your latest translations you can start collaborating with your team members to edit your translations from within the Phrase Translation Center.

To invite your team members, go to our web frontend known as the “Translation Center” click on “Account” and go to your user management. Invite translators, developers or managers to your team all with their own permissions.

Your translators can work from within the Translation Center. Your developers might do some more background work with the API to regularly update translations by pushing first. Through pushing, the local translations added by your developers are transmitted to the Translation Center. By pulling the new content - created by your translators - it is updated in your local application, too. This needs to be done continuously especially when you ship often.

Further Reading

Be sure to subscribe and receive all updates from the Phrase blog straight to your inbox. You’ll receive localization best practices, about cultural aspects of breaking into new markets, guides and tutorials for optimizing software translation and other industry insights and information. Don’t miss out!