Why you should not do the localization process as an iOS Developer

Cover Image for Why you should not do the localization process as an iOS Developer

As an iOS Developer, i18 is sometimes part of our daily process depending on the projects that we're working on. Most of the time, devs are just copy pasting the keys and values from an excel file (or from somewhere else) to the Localizable.strings, which at first is okay, but when the number of supported locales started to increase, this could also trigger some confusion as not everyone can read and validate those strings immediately.

In my opinion, developer should only concern on the base locale, localization keys and its arguments. Other than that, devs should let translator handle the rest of the process for us.

The process I'm suggesting is doing this localization process from the CI/CD or copy Localizable.string as is (and not just one by one, or per key) from a service proivider then replace it to your iOS projects.

To simplify and automate this process, and to avoid some unwanted errors like crash, Yes, it can make your app crashes too due to character encoding issue, not being able to detect by the compiler, I have created an opensource project called Localizr where you can deploy easily to heroku, your local or to your own server (via docker). Localizr handles and automates localization files both iOS and Android (and web via JSON). Basically we give limited access to the translators to let them input or upload different keystrings and the developer will just fetch it during development or deployment only when necessary.

As for testing, we can use strategy like snapshot testing to test the i18 in different device sizes and different languages as it's much faster compare to XCUITest and we can then immediately see if some UIs are okay or not especially that some languages are 3 times longer compare to english (en).

In addition, it is also important have an ability to change the App's current locale on the fly. Yes, App!, not the device, because changing the localization of an iOS device requires to restart the device(which will take some time and not really a great experience for QAs and developers). For your reference of this process, I have an old but still useful example (git repo) here 👉 Localizr.swift.

Please let me know your thoughts. Thank you!