Localizable Strings Dict

Last updated: July 12, 2023Author: Jakub Pomykała

Localization on macOS and iOS looks the same. Both platforms share the same concepts, programming language and localization approach. In Swift world, the most commonly used localization format for pluralization are *.stringsdict files. Each *.stringsdict file contains translated messages that has plural forms and device variants.

Translations format is based on XML, and it's similar to Android strings.xml format. Each translation file contains a dictionary with keys and values. Each value can be a string or a dictionary with plural forms. Each plural form is a dictionary with a key and a value. The key is a plural form name and the value is a translated message.

Note: Localizable.stringsdict files are used only for pluralization and device variants. For simple translations, use Localizable.strings file format.

File format example

<plist version="1.0">
    <dict>
        <!-- Pluralization -->
        <key>%d home(s) found</key>
        <dict>
            <key>NSStringLocalizedFormatKey</key>
            <string>%#@value@</string>
            <key>value</key>
            <dict>
                <key>NSStringFormatSpecTypeKey</key>
                <string>NSStringPluralRuleType</string>
                <key>NSStringFormatValueTypeKey</key>
                <string>d</string>
                <key>zero</key>
                <string>No homes found</string>
                <key>one</key>
                <string>%d home found</string>
                <key>other</key>
                <string>%d homes found</string>
            </dict>
        </dict>

        <!-- Device specific translations -->
        <key>UserInstructions</key>
        <dict>
            <key>NSStringDeviceSpecificRuleType</key>
            <dict>
                <key>iphone</key>
                <string>Tap here</string>
                <key>mac</key>
                <string>Click here</string>
                <key>appletv</key>
                <string>Press here</string>
            </dict>
        </dict>
    </dict>
</plist>

Upload with CLI

simplelocalize upload --apiKey <PROJECT_KEY> \
  --uploadFormat localizable-strings-dict \
  --uploadPath ./{lang}/Localizable.stringsdict

Learn more about SimpleLocalize CLI and translations upload feature.

Download with CLI

simplelocalize download --apiKey <PROJECT_KEY> \
  --downloadFormat localizable-strings-dict \
  --downloadPath ./{lang}/Localizable.stringsdict

Learn more about SimpleLocalize CLI and translations download feature.

Resources