ios – Pluralization with number and name (swift stringsdict)

ios – Pluralization with number and name (swift stringsdict)

In addition to what Andreas said: There is no dictionary for the
%#@name@ variable in the format string, but you can simply use %@
for a Swift string instead. The complete stringsdict entry then
becomes

<key>myKey</key>
<dict>
    <key>NSStringLocalizedFormatKey</key>
    <string>My friend %@ has %#@count@.</string>
    <key>count</key>
    <dict>
        <key>NSStringFormatValueTypeKey</key>
        <string>d</string>
        <key>NSStringFormatSpecTypeKey</key>
        <string>NSStringPluralRuleType</string>
        <key>one</key>
        <string>one dog</string>
        <key>other</key>
        <string>%d dogs</string>
    </dict>
</dict>

You are missing the format type key:

<key>NSStringFormatValueTypeKey</key>
<string>d</string>

For more details on this, see String Format Specifiers

ios – Pluralization with number and name (swift stringsdict)

Leave a Reply

Your email address will not be published. Required fields are marked *