Skip to content

Handle Complex Pluralization with Xcode .stringsdict Files

Master pluralization and variable substitutions in your iOS, macOS, watchOS, and visionOS apps with Lingo.dev's specialized support for Xcode's .stringsdict format.

Quick Setup

Create an i18n.json configuration file in your project root:

json
{
  "version": 1.2,
  "locale": {
    "source": "en",
    "targets": ["es", "fr", "de"]
  },
  "buckets": {
    "xcode-stringsdict": {
      "include": ["MyApp/[locale].lproj/Localizable.stringsdict"]
    }
  }
}

TIP

The [locale] placeholder in the path will be automatically replaced with each language code (e.g., en.lproj, es.lproj).

One Command Translation

Translate all your pluralization rules with a single command:

bash
npx lingo.dev@latest i18n

This automatically:

  1. Reads your source .stringsdict files
  2. Identifies new or modified strings
  3. Translates only what's changed
  4. Creates or updates target language files with correct pluralization forms

Understanding .stringsdict Files

The .stringsdict format is Apple's solution for handling complex pluralization:

xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>items_count</key>
  <dict>
    <key>NSStringLocalizedFormatKey</key>
    <string>%#@count@</string>
    <key>count</key>
    <dict>
      <key>NSStringFormatSpecTypeKey</key>
      <string>NSStringPluralRuleType</string>
      <key>NSStringFormatValueTypeKey</key>
      <string>d</string>
      <key>zero</key>
      <string>No items</string>
      <key>one</key>
      <string>One item</string>
      <key>other</key>
      <string>%d items</string>
    </dict>
  </dict>
</dict>
</plist>

Lingo.dev intelligently:

  • Preserves the XML/plist structure
  • Translates only the string content
  • Maintains all format specifiers and variables

Smart Pluralization Handling

Language-Specific Rules

Different languages have different pluralization forms:

LanguagePlural Forms
Englishone, other
Arabiczero, one, two, few, many, other
Russianone, few, many, other
Japaneseother (only)

Lingo.dev automatically generates the correct forms for each target language.

Format Specifier Protection

All format specifiers are preserved exactly as they appear:

  • %d, %ld, %lld for integers
  • %@ for objects
  • %.2f for formatted decimals
  • Named variables like %#@count@

Advanced Configuration

Multiple Files Support

Include all your project's .stringsdict files:

json
"xcode-stringsdict": {
  "include": [
    "MyApp/[locale].lproj/Localizable.stringsdict",
    "MyApp/[locale].lproj/InfoPlist.stringsdict"
  ]
}

Integration with Other Formats

For complete Xcode localization, combine with other format types:

json
"buckets": {
  "xcode-stringsdict": {
    "include": ["MyApp/[locale].lproj/*.stringsdict"]
  },
  "xcode-strings": {
    "include": ["MyApp/[locale].lproj/*.strings"]
  }
}

Best Practices

Key Consistency

Ensure your pluralization keys match across formats:

  • Use the same key in .strings and .stringsdict files
  • Reference the same key in your code with NSLocalizedString()

Testing Pluralization

Test your app with different quantity values to verify all plural forms work correctly across languages.

Why iOS Developers Choose This Approach

  1. Pluralization Accuracy: Handles complex language rules automatically
  2. Format Preservation: Maintains exact XML structure required by Xcode
  3. Incremental Updates: Only translates what's changed, saving time and resources
  4. Cross-Format Consistency: Works alongside .strings and .xcstrings files
  5. Native Integration: Fits perfectly into Xcode's localization workflow

Lingo.dev supports all Xcode localization formats:

For complex pluralization needs, .stringsdict remains the most powerful option, especially when working with older Xcode versions or specific pluralization requirements.