A Sample on how to localize plural strings in iOS. And "99 Bottles of Beer on the Wall" in Russian.
Today, in a code review I again saw something like this:
if number > 1 {
// use plural
} else {
// use singular
}
Don't do that
I am not sure if it was correct for the native language of the developer, it is worng in most languages. But to the rescue, Apple provides a system to localize your plural forms, and this project is a sample for it.
Currently, the following languages have been implemented:
- Chinese (simplified)
- English
- French
- German
- Polish
- Romanian
- Russian
- Ukrainian
You are more than welcome to create a pull request for your language.
P.S.: The Swift Playground contains the swift version of the "99 Bottles Of Beer" algorithm in Russian