In Localizable.strings
, I have below plural strings with one and other
"User added %@ posts.##{one}" = "User added a post.";
"User added %@ posts.##{other}" = "User added %@ posts.";
I wish to remove it from Localizable.strings and add it to Localizable.stringsdict.
I have done this before for the basic strings with the input format (%d) at the start of string. But, I have never user Localizable.stringsdict for strings having input format in middle of the string
Could anyone help me with exporting the above string in below format?
<key>Fill_Here</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>Fill_Here</string>
<key>Fill_Here</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>Fill_Here</string>
<key>one</key>
<string>Fill_Here</string>
<key>other</key>
<string>Fill_Here</string>
</dict>
</dict>
Thanks in advance
I figured out a way to do this, by modifying dictionary as below
<key>User added %@ posts.</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@posts@</string>
<key>posts</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>User added %d post.</string>
<key>other</key>
<string>User added %d posts.</string>
</dict>
</dict>
Using %@ input format crashes the application in this case. So I modified it to use %d instead.