For the More Curious: Localization and Plurality

Sometimes, you will want to use different strings depending on whether one of the terms in the string is singular or plural.

For example, when you remove a single employee in the English localization of RaiseMan, the app will present an alert with broken English (Figure 26.7).

Figure 26.7  Incorrect message in RaiseMan’s remove alert

Incorrect message in RaiseMan’s remove alert

To address this, you could programmatically check whether the number of employees being removed is equal to one or greater than one. This would work just fine for English and French – but, as it turns out, this is not a robust solution.

In English ...

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.