3 Easy Steps To Localize A Java Play Application

Learn how to translate your Play Framework projects easily with PhraseApp. Localization for Play Framework apps can be tedious. Let's talk about how it's now simplified with PhraseApp.

Short note: This article covers Play 2.x version.

Your Basic Setup

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

  1. Add the desired languages you would want to accept to your conf/application.conf with priority from important to less important locale like so:

    Add the files messages.en, messages.de, and messages.fr to your /conf folder
  2. Start translating / localizing by consulting the official Play Documentation

Integrate With PhraseApp

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

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

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

A sample valid Play Properties file:

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

… or through our phrase gem

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

The tag option is optional but always nice. With this you have a labelling 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 PhraseApp 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 PhraseApp 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!

Also published on Medium.

3 Easy Steps To Localize A Java Play Application
Rate this post