How Plurals Work

Pluralization seems simple: "1 item" vs "2 items." But languages handle plural forms differently.

The Problem#

In English, we have two forms:

  • Singular: "1 file"
  • Plural: "0 files", "2 files", "100 files"

But Russian has more forms:

  • 1 файл (1 file)
  • 2 файла (2 files) — different ending
  • 5 файлов (5 files) — yet another ending
  • 21 файл (21 files) — back to singular-like form

Japanese doesn't distinguish plural at all. Arabic has six different forms.

Plural Categories#

The Unicode CLDR standard defines six categories that languages can use:

CategoryExample Languages
zeroArabic, Welsh
oneEnglish, German, French
twoArabic, Welsh
fewRussian, Polish, Czech
manyRussian, Polish, Arabic
otherAll languages (required fallback)

Each language uses a subset of these. English uses just one and other. Russian uses one, few, many, and other.

The other category is always required. If you skip it, your app will crash or show empty strings.

How .xcstrings Handles Plurals#

When you write Text("\(count) items"), Xcode creates plural variations:

{
  "variations": {
    "plural": {
      "one": {
        "stringUnit": { "value": "%lld item" }
      },
      "other": {
        "stringUnit": { "value": "%lld items" }
      }
    }
  }
}

How XCStrings Translator Helps#

When translating a plural string, XCStrings Translator:

  1. Detects the source string has plural variations
  2. Shows only the categories the target language needs
  3. Validates that all required categories are filled

Translating to Russian shows one, few, many, and other fields. Translating to German shows just one and other—same as English.

Key
Source
Translation
State
%lld files selected
%lld files selected
Translated
one
%lld file selected
%lld Datei ausgewählt
Translated
other
%lld files selected
%lld Dateien ausgewählt
Translated
%lld days ago
%lld days ago
Translated
one
%lld day ago
vor %lld Tag
Translated
other
%lld days ago
vor %lld Tagen
Translated

Next Steps#

Want to explore plural rules interactively? Try the Understanding Plural Rules tutorial with a live CLDR category explorer.