Software localization

Integrating Phrase Into iOS Translation Workflows

We made good experiences with Phrase for our Symfony2 app. We tried it for iOS development. Turns out it also works like a charm with iOS translation.
Software localization blog category featured image | Phrase

In the past, we made good experiences with Phrase for our Symfony2 app (see this post). So we decided to try it for iOS development. As it turned out it works like a charm with iOS Localizable Strings as well.

Our workflow

1. Engineers add new translation keys to the code

NSLocalizedString(@"ACMELoginButton", @"Login button title")

We run a script that uses to generate the strings from the source code

2. We push the new strings as base locale to Phrase

3. The translators get notified about the new strings and can translate them in the Phrase backend

4. We pull the translated strings from Phrase and all new translation keys are translated

Step-by-step tutorial

1. Sign up to Phrase, create your project and remember your authentication token

2. Install the phrase gem

gem install phrase

Go to your project directory and init phrase

phrase init --secret=YOUR_AUTH_CODE

3. Push your existing Localizable.strings files to Phrase to automatically create the languages

phrase push Resources/Localizations/Base.lproj/Localizable.strings

phrase push Resources/Localizations/en.lproj/Localizable.strings

phrase push Resources/Localizations/de.lproj/Localizable.strings

4. Create a small script (e.g. Resources/Scripts/UpdateTranslations.sh) that generates strings for your new translation keys from source, pushes them to Phrase and pulls back the translated strings

#!/bin/sh

localizationsPath="Resources/Localizations/"

find ./ -name "*.m" -print0 | xargs -0 genstrings -o ${localizationsPath}Base.lproj

phrase push ${localizationsPath}Base.lproj/Localizable.strings

phrase pull --target=${localizationsPath} --format=strings

5. Set the script to be executable

chmod +x Resources/Scripts/UpdateTranslations.sh

6. Whenever you want to update your translation keys, run the script

./Resources/Scripts/UpdateTranslations.sh

Done.