Chapter 16. Localization and Internationalization
Selfiegram is shaping up into a pretty nice little app—we’ve got reams of features, a solid tested codebase if we want to add more, and some custom appearances set to make it stand out. What we don’t have is support for anything outside of the English language.
Because all of this book’s authors speak English, it made sense for our app to be developed primarily in English. What doesn’t make sense is for this to be the only language we support. While English is one of the most popular languages out there, it isn’t the only one—literally billions of people don’t speak it. And even if English were spoken as a secondary language by everyone on the planet, that wouldn’t mean they wouldn’t prefer their apps to be in their native languages.
Apple cares a great deal about localization and internationalization and offers excellent support. Internationalization is the process of preparing an app for localization. You do this by separating the text used in your app from the app itself, making it load any user-facing language resources at runtime based on the user’s language preferences, and adjusting your user interface to support different lengths of text. In addition, your app should take into account whether the user’s language displays text in a left-to-right direction (such as English and French) or in a right-to-left direction (such as Hebrew and Arabic). Once you’ve internationalized your application, you can localize it into a specific ...
Get Learning Swift, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.