Inclusivity with Voice & Language

May 30 2025 · Swift 5.9, iOS 17, Xcode 15.3

Lesson 03: Localization for a Global Audience

Demo: Localization for a Global Audience

Episode complete

Play next episode

Next

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

In this demo, you’ll create a string catalog and use it to fix some user-facing text in an app. Then, you’ll create a French version of the app. If you’re following along, download the course materials, start Xcode and open the ClothesPicker app in the 03-localization-for-a-global-audience/Starter folder.

var itemName: String {
  if quantity > 1 {
    return "\(item.name.lowercased())" + "s"
  } else {
    return "\(item.name.lowercased())"
  }
}
Text("\(quantity) \(colorChoice) \(itemName)")
Text("This is a man's \(item.name.lowercased()) that is never worn as well as by a woman.",
     comment: "Description of item, same for all items")
Text("...tall. He wears ...", comment: "Description of model")
Text("Tap to select the color of your \(item.name.lowercased()):",
     comment: "Instruction to user")
Text("\(quantity) \(colorChoice) \(item.name.lowercased())",
     comment: "Displays [number] of [color] [item]")
var itemName: String {
  if quantity > 1 {
    return "\(item.namePlural)"
  } else {
    return "\(item.name.lowercased())"
  }
}

French Version

And finally, the main attraction! It’s time to add another language to the app!


🏃🏻‍➡️%1$@ mesure %2$lld cm. Il porte une taille %3$@.
Cliquez pour sélectionner la couleur de votre %@:
Appuyez pour sélectionner la couleur de votre %@:
C'est un %@ d'homme qui n'est jamais aussi bien porté que par une femme.
.multilineTextAlignment(.center)
String(localized: "Shirt", comment: "Item of clothing")
String(localized: "red", comment: "color")
String(localized: "blue", comment: "color")
String(localized: "green", comment: "color")
String(localized: "black", comment: "color")
noir
bleu
vert
rouge
Chemise
%1$lld %3$@ %2$@
%1$lld %3$@s %2$@
See forum comments
Cinema mode Download course materials from Github
Previous: Localization Techniques Next: Conclusion