Today we looked out for a nice tool to improve our translation workflow for an iOS app. In the past we made good experiences with PhraseApp for our Symfony2 app (see this post). So we decided to try it for iOS developement. As it turned out it works like a charme with iOS Localizable Strings as well.
Our workflow looks like this:
- Engineers add new translations keys to the code
NSLocalizedString(@"ACMELoginButton", @"Login button title")
- We run a script that uses genstrings to generate the strings from the source code
- We push the new strings as Base locale to PhraseApp
- The translators get notified about the new strings and can translate them in the PhraseApp backend
- We pull the translated strings from PhraseApp and all new translation keys are translated
-
Sign up at PhraseApp, create your Project and remember your auth token
-
Install the PhraseApp gem
gem install phrase
-
Got to your project dir and init PhraseApp
phrase init --secret=YOUR_AUTH_CODE
-
Push your existing "Localizable.string" files to phrase to automatically create the languages (you can't create "Base" locale over their backend)
phrase push Resources/Localizations/Base.lproj/Localizable.strings phrase push Resources/Localizations/en.lproj/Localizable.strings phrase push Resources/Localizations/de.lproj/Localizable.strings
-
Create a small script (e.g. Resources/Scripts/UpdateTranslations.sh) that generates strings for your new translation keys from source, pushes them to PhraseApp 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
-
Set the script to be executable
chmod +x Resources/Scripts/UpdateTranslations.sh
-
Whenever you want to update your translation keys, run the script
./Resources/Scripts/UpdateTranslations.sh
-
Done