Ch5 Localization section

Hi, would it be possible to have an updated version of this section with the latest tech for i18n / l10n in Xcode13 and iOS15 ? It appears to me that the workflow described in this chapter is not in line with the new techniques where everything in SwiftUI is localizable by default (?).

Also, may I ask for your help in understanding the “Base Localization” ?
What’s the need of it if English is already set as the base dev language ?
And what’s the need of having a localizable.strings for English ?

Thanks :slight_smile:

Capture d’écran 2021-09-26 à 12.45.05

hi Omar! we’ll be updating the book later this year, and I’ll look into this then.

Base.lproj holds storyboard or xib files, which are the minimum set of files that Xcode assumes must be localized. Most SwiftUI projects don’t have storyboards, but projects usually have a LaunchScreen.storyboard, so you’ll see a Base.lproj folder in Finder.

This is from our internationalization tutorial:

When your app asks iOS for the localized version of a resource, iOS looks first in the appropriate language directory. If that directory doesn’t exist, or the resource isn’t there, iOS will fetch the resource from Base.lproj .

If you don’t localize your app, it won’t have any other lproj folders. As soon as you add a language that isn’t the development language, your project needs one lproj folder for each supported language. Probably simplifies the system logic, if all supported languages are treated the same way.

1 Like

Thanks for your reply Audrey, it makes things clearer for me :slight_smile: Looking forward to the updated version.

One last thing on this subject if I may : English being the development language, there is no need to keep the en.lproj file which is empty ?

In the book, I read : « for (localization) to work, you will also have to localize in the development language » / « set up localization for the project’s development language ». Thus, I take that the en.lproj file is mandatory even if empty. Would be very helpful to understand why it is so ?

My guess is that when the app switches to another language and then reverts to English the compiler needs this file to complete the process.

hi Omar, in the next section Creating en.lproj/Localizable.strings you’ll Localize the Localizable.strings file, and this will create a Localizable.strings file in en.lproj

1 Like