2

I'm trying to populate the 'alert' portion of a push notification with keys to some localized strings in an iOS app. Providing the key to the appropriate string in the 'loc-key' property does what it's supposed to and works great. However, I'd also like to provide a key to a localized string in the 'loc-args' property. When testing, putting the key in 'loc-args' displays the key in the notification on the phone, not the string that the key points at.

Here's an example payload:
{"aps":{"alert":{"loc-key":"STRING_KEY","loc-args":["ANOTHER_KEY"]}}}

Is what I'm trying to accomplish possible at all? Been searching around and I haven't seen this discussed anywhere.

MarcusG
  • 49
  • 1
  • 7

1 Answers1

5

Nested localization is not supported.

You would need to have the STRING_KEY handle the mapping and pass two strings in the loc-args array.

Eric
  • 2,045
  • 17
  • 24
  • Just for reference, can you share the link of documentation where Apple mentioned this ? Is there any other option to achieve this ? – Nitin Aug 07 '14 at 09:16
  • It's all documented in the Local and Push Notification Programming Guide. https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html – Eric Sep 03 '14 at 18:40
  • I know this answer is old, but it would be so great to see an example of how to do it! – hannojg Apr 20 '20 at 15:34
  • Found a solution that is suitable here: https://stackoverflow.com/a/32866886/8490899 – hannojg Apr 20 '20 at 15:38