'Push notification arguments localization

I know that it is possible to localize the message and title of a push notification, using title-loc-key, title-loc-args and loc-key, loc-args. So, that the system searches for the localized-title-formatted-string(title-loc-key) in the app bundle and substitutes the format-specifiers with title-loc-args.

My questions would be that is it possible to localize the arguments of a push notification? So that the system substitutes the format-specifiers of the formatted-string with the localized title-loc-args(arguments substituted with the localized values found in the app bundle).

For example:

Notification:

`title-loc-key`= "localization_key_shipping"
`title-loc-args`= ["localization_key_headset"]

Localization En:

"localization_key_shipping" = "Your %@ is ready for shipping"
"localization_key_headset" = "headset";

Can I make this work to see "Your headset is ready for shipping" ?

Thanks for all of your advices and comments.



Solution 1:[1]

No, your server side code is expected to feed in localized text for arguments. See Apple docs.

Solution 2:[2]

Look at the Notification Service Extensions. That is how you can modify the content of a push notification before is shown to the user.

https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension

A UNNotificationServiceExtension object provides the entry point for a notification service app extension. This object lets you customize the content of a remote notification before the system delivers it to the user. A notification service app extension doesn’t present any UI of its own. Instead, it’s launched on demand when the system delivers a notification of the appropriate type to the user’s device. You use this extension to modify the notification’s content or download content related to the extension. For example, you could use the extension to decrypt an encrypted data block or to download images associated with the notification.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 mahboudz