I had a look at this question and also this post. None of them really answer if it is possible or not, at least not authoritatively.
What I'm trying to achieve is to send notification to my apps¹, this notification does not contain text itself but only localization key for body and title plus arguments for body and title (values) that get filled in as a template. I am using remote push notifications so I rely on loading the strings from app's resources, these are not local notifications as they have to work even if app is in background.
While this works fine for simple cases, some languages need
- multiple plurals on different counts (1, 2, 5 and more)
- different order of arguments applied to template due to specifics of a language
For #1 I really haven't found any solution. It seems like it's not possible with my approach. The documentation for Android and iOS do not seem to have ability to pluralize strings.
For #2 it is possible to do it with Android as the template can be specified with numbers. If I want 2nd argument to come before 1st I can do %2$s ... %1$s
. iOS has only %@
so I assume it is not possible?
¹ I am using FCM which means body_loc_key
and title_loc_key
just contain ID. I then use string resource on Android / Localizable on iOS to load actual text. In this case the text is a template. The payload also contains title_loc_args
and body_loc_args
which are array of values that get applied to the template.