How to handle plurals in localisation objective-c iOS -
i'm going through page see how handle plurals.
i've added english.stringsdict contains following.
<plist version="1.0"> <dict> <key>%d file(s) remaining</key> <dict> <key>nsstringlocalizedformatkey</key> <string>%#@files@</string> <key>files</key> <dict> <key>nsstringformatspectypekey</key> <string>nsstringpluralruletype</string> <key>nsstringformatvaluetypekey</key> <string>d</string> <key>one</key> <string>%d file remaining</string> <key>other</key> <string>%d files remaining</string> </dict> </dict> </dict> </plist>
i've set localisation property in file inspector english have localizable.strings set english contains following.
/* message shown remaining files */ "%d file(s) remaining" = "%d file(s) remaining";
i've set application language in schema english.
i'm setting label text this
self.label.text = [nsstring localizedstringwithformat:nslocalizedstring(@"%d file(s) remaining", @"message shown remaining files"), count];
what being displayed "5 file(s) remaining"
what want display 5 files remaining or 1 file remaining if there 1 file.
you cannot have same key in localizable.strings in localizable.stringsdict. system first looks localizable.strings , if key not found, looks localizable.stringsdict.
solution: remove
/* message shown remaining files */ "%d file(s) remaining" = "%d file(s) remaining";
from localizable.strings
Comments
Post a Comment