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.
- Add the desired languages you would want to accept to your
conf/application.confwith priority from important to less important locale like so:1application.langs="en,de,fr"
Add the files
messages.frto your /conf folder
- 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:
# My Software Project (description)
# You can never have enough titles!
more_titles Another Title
You can now easily upload the locale file to Translation Center:
… 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 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.
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.
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.