cocoa touch - iOS - Hanling plural noun localization with .stringsdict - not working -
i trying implement plural rules localisation. i.e., expect "one file..." when argument 1, "2 files..." when argument 2 , likewise.
i followed apple guidelines. results plural, 1 i.e, "1 files...".
i've created localizable.stringsdict file following content (exactly apple guidelines).
<?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>%d messages in inbox</key> <dict> <key>nsstringlocalizedformatkey</key> <string>%#@messages@ in inbox</string> <key>messages</key> <dict> <key>nsstringformatspectypekey</key> <string>nsstringpluralruletype</string> <key>nsstringformatvaluetypekey</key> <string>d</string> <key>one</key> <string>one message is</string> <key>other</key> <string>%d messages are</string> </dict> </dict> </dict> </plist>
this how use key in code
nslog(@"%@", [nsstring localizedstringwithformat:nslocalizedstring(@"%d messages in inbox", @"message shown remaining files"), 1]);
what problem?. here sample code have tried far.
while debugging, i've noticed localization.stringsdict
file ignored. when i've recreated it, started work properly. guess original file created wrong type: correct type should property list
.
i've sent pull request suggested.
Comments
Post a Comment