Localizing String Literals

What about the places in your application where you programmatically determine what text is displayed to the user, such as with a string literal or a Swift string interpolation? In Document.swift, you have the following line of code:

let alert = NSAlert()
alert.messageText = "Do you really want to remove these people?"
alert.informativeText = "\(selectedPeople.count) people will be removed."
alert.addButtonWithTitle("Remove")
alert.addButtonWithTitle("Cancel")

That alert sheet is not going to bring about world peace.

You have already created a strings file to localize Document.xib. In addition to any strings files you may have for XIB files, you will want to create a strings file for strings that are ...

Get Cocoa Programming for OS X: The Big Nerd Ranch Guide 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.