Hi!I'm working with remote pushes, and i have a problem with localisation and plurals. I'm not sure, if it's a bug, or not supported (why?), or i just missed something simple.Some simplified code for local notification:let content = UNMutableNotificationContent()
content.title = NSLocalizedString("Notifications.NewMessage.Title", comment: "notification header")
content.body = String.localizedStringWithFormat(NSLocalizedString("Notifications.NewMessage.BodyFormat", comment: "notification body"), 3)
content.sound = UNNotificationSound(named: "notification.mp3")
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false)
let request = UNNotificationRequest(identifier: "notification", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)Here a payload for remote push notification (i use Pusher for testing), with same content and same localisation keys:{
"aps": {
"alert": {
"title-loc-key": "Notifications.NewMessage.Title",
"loc-key": "Notifications.NewMessage.BodyFormat",
"loc-args": [3]
},
"badge": 3,
"sound": "notification.mp3"
}
}Result: locals works fine, remotes are broken. Screenshot.Plurals stringdict:<?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>NotificationsService.NewMessage.BodyFormat</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>You have %#@messages@</string>
<key>messages</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>%d new message</string>
<key>other</key>
<string>%d new messages</string>
</dict>
</dict>
</dict>
</plist>It's may be a problem with string format "d", which is integer, and "loc-args" array, whitch is "Array of strings", but if we change NSStringFormatValueTypeKey to @ for string, app will crash.