I'd like to use Firebase to send push notifications to both Android and iOS devices which are localized.
I realized we didn't really have a solution for sending localized messages to subscribed topics. Pretend I have a message 'North Korea leader threatens Guam' that I want to send to people subscribed to the 'News' topic and 1000 people are subscribed (and they all speak different languages). I was hoping Firebase records the devices locale when requesting a FCM token, and that I could just send an array of messages per locale to this topic and let FCM/firebase handle, like so:
{
"default_message": "North Korea leader threatens Guam",
"en_US": "North Korea leader threatens Guam",
"en_GB": "North Korea leader threatens Guam",
"es_MX": "Líder de Corea del Norte amenaza a Guam",
"fr_FR": "Le chef de la Corée du Nord menace Guam",
"de_DE": "Nordkorea-Führer droht Guam"
}
I have seen some references to maybe using title_loc_key, body_loc_key but don't see a good example on how the request would look like. These 2 params also imply maybe they are just used as a translation lookup key that the app also has to store and lookup locally, and I can't send a brand new off-the-cuff localized message to people (since the translation would have to be stored in the app beforehand like 'april_newsletter_text')? Not sure how it works, just throwing some thoughts out there.
Note: I am using a php library to do send firebase push notifications (Laravel-FCM). I believe some devs in our team have also extended that library a bit to do some custom tasks so if there is a way to do it directly via GCM (gcm-http.googleapis.com/gcm/) instead of FCM, then I can add.