Prompt
How do I send localized push notifications by language?
Latest observation
To send localized push notifications by language, the usual pattern is:
- Store each user’s preferred language
- Group users by language when sending
- Use a translation table / localization files for each notification message
- Send the message in the user’s language via your push provider
Common approaches
1) Send one push per language segment
If your push service supports targeting by segments or topics, create a segment for each language, like:
lang_enlang_eslang_fr
Then send the same campaign with different localized text to each segment.
Example
- English: “Your order has shipped”
- Spanish: “Tu pedido ha sido enviado”
This is the cleanest approach when most users share a few supported languages.
2) Use localization keys in the push payload
Some platforms let you send a localization key instead of hardcoded text.
For example:
{
"title_loc_key": "ORDER_SHIPPED_TITLE",
"body_loc_key": "ORDER_SHIPPED_BODY"
}
Then the app uses its local string resources to display the message in the device’s language.
This is common on:
- iOS with localized notification resources
- Android with
title_loc_key/body_loc_keystyle payloads
This works best when the app already has the strings bundled locally.
3) Personalize server-side before sending
If your push system doesn’t support localization keys, generate the message on the backend:
- Read user’s language preference from DB
- Pick the correct translation
- Send the push with the translated title/body
Example pseudo-code:
const translations = {
en: { title: "Welcome", body: "Thanks for signing up" },
es: { title: "Bienvenido", body: "Gracias por registrarte" },
fr: { title: "Bienvenue", body: "Merci de vous être inscrit" }
};
function getMessage(lang) {
return translations[lang] || translations.en;
}
Recommended data model
Store something like:
{
"userId": "123",
"pushToken": "abc",
"language": "es"
}
If users can change language, update this field immediately.
Best practices
- Fall back to English if a language is missing
- Translate title and body separately
- Localize dates, currencies, and names if included
- Keep strings short so they fit push UI limits
- Test on real devices because push rendering differs by platform
Platform notes
iOS
- Use localization in the app bundle when possible
- Or send fully translated text from the server
Android
- Can use localization keys and resources in the app
- Or send translated content directly
Firebase Cloud Messaging (FCM)
- Supports both:
- server-side translated text
- localization keys for Android
- For cross-platform apps, many teams still localize on the backend for consistency
Simple workflow
- User selects app language
- Save that language in the backend
- When sending a notification:
- query users by language
- choose the matching translation
- send push in batches by locale
If you want, I can show you how to do this specifically for Firebase Cloud Messaging, iOS APNs, Android, or a Node.js backend.