Posts Tagged ‘Localizable.stringsdict’

I’d like to close 2014 writing about one of the hottest topics: language plural and gender rules.  One of the issues I run more often into when I work on mobile apps is in fact the way developers handle plurals and genders.  I’ve had the opportunity to raise this issue with many apps developers and designers lately, and I was surprised to learn that unfortunately very few of them are aware of the complexities of other languages and the way to tackle this kind of problem.

In my opinion, it is paramount for Mobile developer and designers to think ahead about their global audience and build these language plural rules in their apps since the very beginning.  I’ve been insisting a lot on this, because internationalizing the strings of their apps retroactively is a lot more work than doing it incrementally throughout development.  And more costly too.

Language rules
So what exactly are these Plural Rules?  Let’s take this example:

You need to count the number of people following you.  In English you can get away with 2 strings:

X followers (when X is equal to 0 or more than 1)
X follower (when X is equal to 1)

Imagine your app suddenly becomes a hit oversea, for example in Russia.  You need to localize it and you send your string files to the Localization team.

If you’re Localization team is a good one, they will tell you that you can get away with that quick one/not one check when pluralizing nouns.  These are the only two categories in English, but other languages aren’t that simple.  Your Russian users have 4 different rules for pluralizing their nouns!  And if you think this is complicated, Arabic speakers have six!

If you want to learn more about plural rules, you can read the Unicode Common Locale Data Repository (CLDR) Project which provide tables and charts that can help developers to handle these cases.   The category names (i.e. zero, one, two, few, many, and other) are common across all languages and the rules define the mapping between a quantity and the plural category to use.

For example, for English we would use:

one ⇒ i = 1 and v = 0 (where i = integer value and v = number of visible fraction digits)
other ⇒ No rule, or any other number.

But for Russian, we would use:

one ⇒ v = 0 and i % 10 = 1 and i % 100 ≠ 11
few ⇒ v = 0 and i % 10 = 2..4 and i % 100 ≠ 12..14
many ⇒ (v = 0 and i % 10 = 0) or (v = 0 and i % 10 = 5..9) or (v = 0 and i % 100 = 11..14)
other ⇒ No rule, or any other number.

Gender Rules
To correctly support gender in languages you can follow a similar pattern to the Plural Rules. English has three options: Male, Female, and Neutral (Modern English retains features relating to natural gender, namely the use of certain nouns and pronouns, such as he and she). Polish has five! Yes, five! (Feminine, Neuter, Person-masculine, Animate-masculine, Inanimate-masculine).  And because there’s so much variation across languages, systems like the CLDR just assign each gender a number:

  • 0 for male
  • 1 for female
  • 2 for neutral

Apple’s Localizable.stringsdict

In the past there wasn’t any option for properly internationalizing your iOS app.   The good news is that in mid 2013, Apple released Localizable.stringsdict that provides built-in support for plural and gender rules in the Foundation Release Notes for iOS 7 and OS X 10.9.

If you start to use these categories even before you need it, you will be able to reach a global audience faster than you would otherwise, saving yourself a lot of work, time and money!

What’s there not to like?