Automate iOS localization starting from Google sheets, export them into CSV files, and generate Localizable.strings and Swift structs.
It is tedious to do localization on iOS. You have to add keys to the localization file, and update them manually after a while. Then to use them you need to hard code the correct keys into the
Another problem is that you need to sync the localization file with your Android team. Imagine adding a new screen in an existing app. Mobile engineers then also receive a set of new texts in different languages for that screen, supposedly in some pdf, Excel, etc. files. Now each developer have to convert them into format for one’s own mobile platform, iOS or Android, copy and paste texts manually, come up with their own localization keys. It’s unsurprising if anything will go wrong in this process.
We propose an automated process that makes lives easier. Just use Google sheets as a single source of truth for localization, including the keys, and export them to CSV files using Google Script. You can comment, highlight the text, leave some untranslated cells blank.
Then from those CSVs, a Python script on your local laptop will convert them to
Localizable.strings, and then into Swift structs (example) respectively, ready for use! The script can be easily modified for Android (XML).
Now you can’t go wrong with localization keys anymore, and, you got autocompletion!
Note that you can also use R.swift to generate structs.