I18N-008 recommended Best Practices

Plural forms handled correctly

Different languages have different plural rules (English has 2, Russian has 3, Arabic has 6). String concatenation breaks pluralization.

Question to ask

""1 items" — still lurking somewhere in your UI?"

Verification guide

Severity: Recommended

Different languages have different plural rules:

  • English: 1 item, 2 items (2 forms)
  • Russian: 1 товар, 2 товара, 5 товаров (3 forms)
  • Arabic: 6 different plural forms

${count} items breaks in most languages.

Check automatically:

# Check for ICU message format (handles plurals properly)
grep -riE "plural|selectordinal|\{count,|{n," src/ --include="*.json" --include="*.ts" --include="*.tsx" 2>/dev/null | grep -v node_modules | head -10

# Check i18n library plural support
grep -riE "i18next.*plural|pluralRules|formatPlural|FormattedPlural" src/ --include="*.ts" --include="*.tsx" --include="*.js" 2>/dev/null | head -5

# Look for translation files with plural keys (i18next convention)
grep -riE "_plural|_one|_other|_zero|_few|_many" src/ --include="*.json" 2>/dev/null | head -10

# RED FLAG: String concatenation for counts (breaks pluralization)
grep -riE '`\$\{.*\}\s*(item|file|user|message|result)s?`|"\s*\+.*\+\s*".*s\b' src/ --include="*.ts" --include="*.tsx" 2>/dev/null | head -5

Pass criteria:

  • i18n library with plural support (i18next, react-intl with ICU)
  • Translations use plural syntax, not string concatenation
  • Multiple plural forms defined for languages that need them

Fail criteria:

  • ${count} item(s) or ${count} items patterns
  • Only "one" and "other" forms for languages needing more
  • Plural logic in code instead of translation system

Evidence to capture:

  • Plural handling approach
  • ICU/plural syntax in translation files
  • Languages with complex plurals supported

Section

42. Internationalization (i18n)

Team & Development