Skip to main content
Apple Stringsdict (.stringsdict)
Nick Ustinov avatar
Written by Nick Ustinov
Updated this week

Apple Stringsdict files (.stringsdict) are used to store plural keys and their values in iOS and macOS applications. These files are a type of property list (.plist) that consists of key-value pairs specifically designed to handle complex pluralization rules.

Technical information

Overview

Format name:
Apple Stringsdict

File extensions:
.stringsdict

Common use cases:
Managing localized pluralization rules in iOS and macOS applications.

Technical details:

  • Structure: The .stringsdict file is a .plist file containing key-value pairs. Each key represents a specific plural rule, and its value is a dictionary that defines how the pluralization should be handled.

  • Encoding: UTF-8

Example:
Here's an example of a typical Apple Stringsdict file:

<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
  <dict>
    <key>ref_invite_format</key>
    <dict>
      <key>NSStringLocalizedFormatKey</key>
      <string>%#@format@</string>
      <key>format</key>
      <dict>
        <key>NSStringFormatSpecTypeKey</key>
        <string>NSStringPluralRuleType</string>
        <key>NSStringFormatValueTypeKey</key>
        <string>li</string>
        <key>one</key>
        <string>Invite friend</string>
        <key>other</key>
        <string>Invite %li friends</string>
      </dict>
    </dict>
  </dict>
</plist>

In this example, the ref_invite_format key defines pluralization rules for inviting friends, where the NSStringLocalizedFormatKey provides a reference format, and the nested dictionary specifies different plural forms.

Known limitations

  • Complex structure: Managing pluralization rules can be more complex compared to simple key-value pairs.

  • Dependency on .strings files: For a complete localization setup, you need both .strings and .stringsdict files.

Using with Lokalise

Lokalise supports Apple Stringsdict files, making it easy to manage your pluralization rules directly within the Lokalise platform. When importing .stringsdict files into Lokalise, each plural key must be handled as described in the handling plural keys section.

Using Lokalise with Apple Stringsdict files streamlines your localization process, ensures consistency across different languages, and maintains a centralized translation workflow.

Supported project types

Please note that Apple Stringsdict files can be uploaded only to Web and mobile projects.

Handling plural keys

Due to the specifics of .stringsdict, each plural key in iOS should be maintained as (at least) two keys in Lokalise:

  • The first Lokalise key (for example, number_of_days), which is not plural, should contain the value of NSStringLocalizedFormatKey (for example, %#@the_plural_1@).

  • The second Lokalise key, containing the actual plurals, should be named the same as the first key, followed by :: and a reference used in the NSStringLocalizedFormatKey (for example, number_of_days::the_plural_1).

There is no limit on the number of references within each NSStringLocalizedFormatKey.

Note that you need to export Apple Strings to get both .strings and .stringsdict files in the bundle.

Exporting resources

When exporting Apple Stringsdict files from Lokalise, ensure that both .strings and .stringsdict files are included in the bundle. This guarantees that all pluralization rules and key-value pairs are correctly applied in your application.

Did this answer your question?