Posts

Post marked as solved
6 Replies
3.6k Views
Hi.I was trying to do internationalization friendly pluralization in my code.My source string looks like this:NSString *fromString = [NSString localizedStringWithFormat:NSLocalizedString(@"%@ + %d other(s)", @"The from field for the message cell"), senderName, numberOfParticipants];And I added the following to the stringsdict file for the project:<key>%@ + %d other(s)</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@others@</string> <key>others</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>d</string> <key>zero</key> <string>%@</string> <key>one</key> <string>%@ + %d other</string> <key>other</key> <string>%@ + %d others</string> </dict> </dict>But the only string that was being displayed was from the other category.John Doe + 0 othersJohn Doe + 1 othersJohn Doe + 2 othersAfter some trial and error my source string ended up like this:NSString *fromString = [NSString localizedStringWithFormat:NSLocalizedString(@"%2$@ + %1$d other(s)", @"The from field for the message cell"), numberOfParticipants, senderName];My stringsdict I formatted it like this:<key>%2$@ + %1$d other(s)</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@others@</string> <key>others</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>d</string> <key>zero</key> <string>%2$@</string> <key>one</key> <string>%2$@ + %1$d other</string> <key>other</key> <string>%2$@ + %1$d others</string> </dict> </dict>This gave me:John DoeJohn Doe + 1 otherJohn Doe + 2 othersI'm really skeptical of calling it a solution. It seems like you should be able to specify the position of the parameter to read for the count of items, but I can't find any example or documentation which can enlighten me. The internaionalization guide only deals with simple strings with zero or one replacement parameters, the documentation for localizedStringWithFormat doesn't mention any special handling for pluralization.What am I doing wrong?
Posted Last updated
.
Post marked as solved
5 Replies
2.3k Views
I'd like to turn off the dismiss swipe that iOS 13 puts on any and every formsheet. It seems that setting modalInPresentation isn't enough. I have a 3D view that's displayed as a formsheet on iPad and the implicit dismiss gesture is interfering with our navigation gestures in the 3D view.How can I remove the gesture?
Posted Last updated
.