Automate iOS Storyboard Localization

If your iOS app has several storyboards and you want the translation process to be fully automated, there is no best practice. This is why we decided to change our workflow a little bit and create a new custom script. This guide will show our approach to storyboard localization for iOS in Xcode.

Malte is the founder of Askano, a social recommendation app.

It’s easy to integrate automated translation into your app using our workflow or – if you’re okay with a manual step in your workflow – by using XLIFF as mentioned here by Matthias Nitsche.

Our Setup

We use this folder structure for our apps:

  • Application/
  • Controllers/
    • Controller1/
      • Controller1.storyboard
    • Controller2/
      • Controller2.storyboard
    • Controller3/
      • Controller3.storyboard
  • Library/
  • Models/
  • Ressources/
    • Scripts/
      • UpdateTranslations.sh
    • Localizations/
      • Localizable.strings
      • InfoPlist.strings
  • Vendors/

Our languages are en, es, fr and de.

The Script

The task is to automate the extraction of strings and the push & pull of all .strings files to/from the PhraseApp translation center. So we created the UpdateTranslations.shscript that takes care of it. You can run this script at any point in your deployment process (e.g. during your build phase).

In the first part of the script we are going to push the storyboard .strings files with a tag to PhraseApp. This way we can easily pull back only the needed translation keys afterwards. Part 2 of the script is basically the push of new translation keys to PhraseApp and the pull of translations. (See [our workflow] for details)

phraseapp_push_pull

Script Config

Part 1: Storyboard Translation

Part 2: Push And Pull The Standard Translation Files

Summary

It’s a little bit laborious to achieve this fully automated solution. But since a manual solution with XLIFF files was not an option for our processes, we needed this. ThePhraseApp API documentation helped us to create a custom workflow that fits our needs.

You can find the complete UpdateTranslations.sh script here:https://gist.github.com/mamarx/9f4464dd8b2c95139aad


Also published on Medium.

Comments