Apple Stringsdict (.stringsdict)

Updated 2 months ago ​by Nick Ustinov

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

Handling plural keys

Due to specifics of .stringsdict, each plural key in iOS should be maintained as (at least) two keys in Lokalise.  First Lokalise key (for example "number_of_days"), which in fact is not plural, should contain value of NSStringLocalizedFormatKey (for example "%#@the_plural_1@").  Second Lokalise key (containing actual plurals) should be called the same as first Lokalise key following :: and a reference used in NSStringLocalizedFormatKey (for example "number_of_days::the_plural_1"). 

There is no limit for 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>

How did we do