I'm struggling to make "stringdict" rules work as i need. Already managed to make Int values work correctly by using "d" in NSStringFormatValueTypeKey.
But in 1 case I need to pass a string. I use "s" specifier in stringdict but for some reason i get a string with "(null)" instead of my value.
I haven't found any example for working with string values (yes, it doesn't have a plural form but I still need to use stringdict because of localization). Don't know what keys to use as "one","zero" do not make any sense for string.
This is how I format the string
let inMinVal: String = "some text value"
let format = NSLocalizedString("select %s days to exercise", comment: "")
let retVal = String(format: format, inMinVal)
And here comes my stringdict file:
<?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>select %s days to exercise</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>There's no better time to start than now. Select %#@v2_min@ when you are gonna exercise. The sessions intensity will adapt based on your choices.</string>
<key>v2_min</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>s</string>
<key>one</key>
<string>%s DAYS</string>
<key>zero</key>
<string>%s DAYS</string>
<key>other</key>
<string>%s DAYS</string>
</dict>
</dict>
</dict>
</plist>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…