How to localize an iOS app programmatically (made easy)
5 min readJun 9, 2021
Sometimes we want our apps to support multiple languages to reach a higher audience.
This is when we turn to localization.
Localization vs Internationalization in CS
- Localization is the process of adapting the software to support different languages, time zones, and respect laws and cultures of different regions and locales
- Internationalization is the process of designing a software that meets the needs of the users all around the world, for instance: designing an app that adapts to the RTL languages.
Localization is about the content.
Internationalization is about the UI.
Localizing our app
Localizing our app consists of 2 basic steps:
- Creating strings that can be localized (
NSLocalizedString
); - Physically localizing and translating our strings;
Creating strings that can be localized
In order to localize strings, we have to use NSLocalizedString
.
We declare a NSLocalizedString
like this:
let hello = NSLocalizedString("hello", comment: "greeting")
Where the first string (hello) is the one we want to be displayed and the second (“greeting”) is the description of the first.