Apple Stringsdict (.stringsdict)
Nick Ustinov avatar
Written by Nick Ustinov
Updated over a week ago

Apple Stringsdict format is used to store plural keys and their values. The .stringsdict file is a .plist file that consists of key-value pairs.

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 in fact is not plural, should contain the value of NSStringLocalizedFormatKey (for example %#@the_plural_1@).  The second Lokalise key (containing actual plurals) should be called the same as the first Lokalise key following :: 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, you need to export Apple Strings in order to get both .strings and .stringsdict in the bundle.

Sample data

<?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>
Did this answer your question?