Skip to content

Instantly share code, notes, and snippets.

@floriankugler
Created February 2, 2014 12:49
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floriankugler/8767926 to your computer and use it in GitHub Desktop.
Save floriankugler/8767926 to your computer and use it in GitHub Desktop.
NSStringGenderRuleType example
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>congratulate %@ to %d(his/her) birthday</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>Congratulate %@ to %#@pronoun@ birthday</string>
<key>pronoun</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringGenderRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>0</key>
<string>his</string>
<key>1</key>
<string>her</string>
</dict>
</dict>
</dict>
</plist>
@floriankugler
Copy link
Author

This doesn't work yet. The output is always something like "Congratulate Paul to (null) birthday".

@vlas-voloshin
Copy link

@floriankugler just wanted to share my findings: NSStringGenderRuleType finally works starting from iOS 9.0. Better late than never!

@joshwoods
Copy link

This is pretty much the only thing on all of the internet that provides an example for NSStringGenderRuleType...I have filed feedback to Apple to hopefully get their documentation for localization/stringsdict updated. I suggest everyone else does the same! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment