I want to translate this string using a plurar stringdict in swift for iOS
Using a simple plural without pla
Positional parameters n$
are one-based, so in
let label = String.localizedStringWithFormat(format, kidsIds.count, "Name")
"Name"
is the second parameter, and you reference it with %2$@
:
NSStringLocalizedFormatKey
%#@format@
format
NSStringFormatSpecTypeKey
NSStringPluralRuleType
NSStringFormatValueTypeKey
li
one
Sleeps at %2$@
other
Sleep at %2$@
In your code, %1$@
refers to the first argument kidsIds.count
.
That is not a string which leads to the crash.
Alternatively, put it into the NSStringLocalizedFormatKey:
NSStringLocalizedFormatKey
%#@format@ at %@
format
NSStringFormatSpecTypeKey
NSStringPluralRuleType
NSStringFormatValueTypeKey
li
one
Sleeps
other
Sleep