Play Framework PhraseApp Setup

Summary

This guide will lead you through the integration of PhraseApp into an existing Play Framework application.


Overview

  1. Install the PhraseApp command line client
  2. phraseapp init
  3. phraseapp push
  4. phraseapp pull

This guide covers the setup of a Play application with PhraseApp for translation management. Play Framework is a High Velocity Web Framework for Java and Scala. This article covers Play version 2.

If you’re new to internationalization with Play Framework, you might want to check out the i18n guide from Typesafe.

Prepare your application

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

application.langs="en,de,fr"

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

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

A sample valid Play Properties file might look like this:

# My Software Project (description)
project.name=Some Name
title1=AwesomeApp

# You can never have enough titles!
more_titles=Another Title

Installation

1. Install the PhraseApp command line client

Download the latest PhraseApp Client and follow the setup instructions.

2. Configure the command line tool for your project

To initialize the project configuration, just follow the instructions to initialize the PhraseApp command line tool:

$ phraseapp init

This will guide you through the necessary steps to configure your sources and targets for your project. Make sure you select play_properties as your locale file format.

3. Upload locale files

Uploading your data to PhraseApp is easy. Just execute the push command:

$ phraseapp push

All existing localization files found in your path will be uploaded to your PhraseApp project. Log into Translation Center to see your existing translations and add new languages or keys.

4. Download locale files

Once you have finished working on your translation in Translation Center or the In-Context Editor, you might want to download the data back into your project. This can be done by executing the pull command:

$ phraseapp pull

Next Steps

Now that your app has the latest translations you can start collaborating with your team members and edit your translations from within the PhraseApp Translation Center.


More