Early access · launching soon. Request access

Early access

Early access · launching soon
Product
IntelligenceEarly access. Designed and in development. No results yet. See what's left on the roadmap.
Developers
Resources
Request access

A person reads every request.

Users and audienceEarly accessDesigned and in development. No results yet. See what's left on the roadmap.

Languages and localized push messages

Oricato Team Last updated SDK 1.0.1

Early access · launching soon.

Oricato sends each person one notification in one language: the language your app is showing them. The SDK reports that language for every subscription. Each message carries up to 250 translations and a default language. When the message goes out, the server picks one translation per subscription, so a phone only ever receives its own language.

This guide covers both sides:

  • In your app: make sure the SDK reports the language the app shows, not just the phone’s language.
  • In each message: add translations, choose the default, and test each language on a real device.

Prerequisites

  • The Oricato SDK 1.0.1 is in your app and Oricato.initialize runs at startup. See the Android, iOS or Flutter quickstart.
  • At least one test device in your project. In the dashboard, open the device in Audience and click Mark as test device.
  • To send from your servers: a REST API key. See the REST API quickstart.

How Oricato picks the language

Every subscription stores one normalized language code. Every message has translations and a default_language. For each subscription, the server picks a translation in this order:

  1. The translation for the subscription’s exact language (es gets es).
  2. For Chinese only: if zh-hant is missing, use zh-hans. If zh-hans is missing, use zh-hant.
  3. The message’s default_language translation.

A subscription whose language is unknown (und) goes straight to step 3. There is no per-field fallback: if the chosen translation has an empty title or subtitle, it stays empty. Oricato does not borrow it from the default language.

Language codes

The SDKs and the server use the same normalization rules, and the server’s result is the one stored. Region and script are dropped, except that Chinese keeps Simplified or Traditional. Old ISO codes become their current codes.

What the app or device reports Stored as
en_US, en-GB, EN en
es-MX, es-ES es
pt-BR, pt-PT pt
zh-Hans-CN, zh_CN, zh, zh-SG zh-hans
zh-Hant, zh-TW, zh_HK, zh-Hant-MO zh-hant
in, in-ID id
iw-IL he
ji yi
fil-PH fil
empty, *, 123 und

Because the region is dropped, one pt translation serves Brazil and Portugal, and one es translation serves Mexico and Spain. Write each translation so it reads well in all the regions you serve.

Step 1: Make your app report its language

The SDK reports the language the app is currently showing. It observes that language while your app is in the foreground, saves it, and sends it with every subscription update. Background work, such as a token refresh or a retry, always sends the saved value. It never replaces your app’s language with the phone’s language.

Platform What the SDK reads
Android The locale of the resumed Activity (activity.resources.configuration.locales[0]), read on every resume. This includes AppCompat per-app locales and locale-wrapping helpers. Before any Activity has resumed, it uses the per-app locale on Android 13+ (LocaleManager), or else the device locale.
iOS Bundle.main.preferredLocalizations.first, read when the app becomes active. If that is Base, it uses the app’s development localization.
Flutter The value you pass to Oricato.setLanguage. Without it, the SDK uses the device locale (PlatformDispatcher.instance.locale), read on the main isolate when the app resumes and when the device locales change.

Override the language with setLanguage

Call setLanguage(code) when your app picks its language by itself, for example with an in-app language picker that does not use the platform’s locale APIs. The SDK normalizes the code and sends it from then on. Pass null (nil in Swift) to follow the app locale again.

Android (Kotlin)

import com.oricato.push.Oricato

// The person picked Spanish in your app's own language screen.
Oricato.setLanguage("es")

// Follow the app locale again.
Oricato.setLanguage(null)

On Android, a call made before Oricato.initialize is queued and applied once the SDK starts.

If your app switches languages with AppCompat per-app locales, you don’t need setLanguage. The SDK reads the new locale when the recreated Activity resumes:

import androidx.appcompat.app.AppCompatDelegate
import androidx.core.os.LocaleListCompat

AppCompatDelegate.setApplicationLocales(LocaleListCompat.forLanguageTags("es"))
// No Oricato call is needed here.

iOS (Swift)

import OricatoPush

// The person picked Spanish in your app's own language screen.
Oricato.setLanguage("es")

// Follow the app's localization again.
Oricato.setLanguage(nil)

Flutter (Dart)

import 'package:oricato_push/oricato_push.dart';

// The person picked Spanish in your app's own language screen.
await Oricato.setLanguage('es');

// Follow the app locale again.
await Oricato.setLanguage(null);

On Flutter, call setLanguage after Oricato.initialize has finished. A call made while initialize is still running waits for it. A call made before any SDK state was ever saved (in practice, the first launch before initialize) is logged as an error and ignored.

Flutter: report the locale your app resolved

The Flutter SDK can’t see which locale your MaterialApp resolved. If the phone is set to French but your app only supports English and Spanish, Flutter shows English, while the device locale still says French. Report the resolved locale from a widget below MaterialApp. Here it is a small wrapper used in MaterialApp.builder:

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:oricato_push/oricato_push.dart';

class LanguageReporter extends StatefulWidget {
  const LanguageReporter({super.key, required this.child});

  final Widget child;

  @override
  State<LanguageReporter> createState() => _LanguageReporterState();
}

class _LanguageReporterState extends State<LanguageReporter> {
  String? _reported;

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();
    final tag = Localizations.localeOf(context).toLanguageTag();
    if (tag != _reported) {
      _reported = tag;
      unawaited(Oricato.setLanguage(tag));
    }
  }

  @override
  Widget build(BuildContext context) => widget.child;
}

// In your app widget:
MaterialApp(
  supportedLocales: const [Locale('en'), Locale('es')],
  localizationsDelegates: AppLocalizations.localizationsDelegates,
  builder: (context, child) =>
      LanguageReporter(child: child ?? const SizedBox.shrink()),
  home: const HomePage(),
);

AppLocalizations stands for your app’s generated localizations class. didChangeDependencies runs again whenever the app’s locale changes, so the reported language stays current.

Step 2: Add translations to the message

In the dashboard

Open the composer and go to section 2, What it says.

  1. Under Languages, click Add language and pick a language. Each language gets its own tab with Title and Message fields, plus a Subtitle field when the message targets iOS. Message in the dashboard is the body field in the API.
  2. Write each language. The Message size meter shows the selected language for each targeted platform. A red dot on a language tab marks any other language that is over the limit.
  3. Check the alert under the tabs. It lists the audience languages that have no translation yet, how many people speak them, and which version they will get instead. Click Add next to a language to add it.
  4. Use Preview language (⌥L) in the preview panel to check each language on the Android and iOS mock devices.

With the REST API

POST /api/v1/messages takes the same message fields as the dashboard. This example uses the eight sample languages and sends only to your test devices (test_only), so you can check it before a real send:

{
  "name": "Daily lesson reminder",
  "content": {
    "default_language": "en",
    "translations": [
      { "language": "en", "title": "Your lesson is ready", "body": "Take five minutes to practice today." },
      { "language": "es", "title": "Tu lección está lista", "body": "Dedica cinco minutos a practicar hoy." },
      { "language": "fr", "title": "Votre leçon est prête", "body": "Prenez cinq minutes pour vous entraîner aujourd'hui." },
      { "language": "de", "title": "Deine Lektion ist bereit", "body": "Nimm dir heute fünf Minuten zum Üben." },
      { "language": "pt", "title": "Sua lição está pronta", "body": "Reserve cinco minutos para praticar hoje." },
      { "language": "ja", "title": "レッスンの準備ができました", "body": "今日は5分だけ練習しましょう。" },
      { "language": "hi", "title": "आपका पाठ तैयार है", "body": "आज अभ्यास के लिए पाँच मिनट निकालें।" },
      { "language": "ar", "title": "درسك جاهز", "body": "خمس دقائق من التدريب اليوم تكفي." }
    ]
  },
  "audience": { "test_only": true },
  "schedule": { "mode": "now" }
}
curl -X POST "<ORICATO_API_ADDRESS>/api/v1/messages" \
  -H "Authorization: Bearer $ORICATO_API_KEY" \
  -H "Content-Type: application/json" \
  -d @message.json

Sample translations are short on purpose. Have a native speaker review every translation before a real send.

Translation rules (the API returns 400 validation_failed when one is broken):

Field Rule
content.translations[] 1 to 250 translations, each language used once
content.translations[].language A language code. The server normalizes it (pt-BR becomes pt). und is accepted but never picked, so do not add it.
content.translations[].title Up to 250 characters, optional
content.translations[].subtitle Up to 250 characters, optional, shown on iOS only
content.translations[].body Required, 1 to 2,000 characters
content.default_language Required, and it must have a translation

Keep each translation under the payload limit

Every translation must fit in one push payload on every targeted platform: 4,000 bytes on Android and 3,800 bytes on iOS. The limit counts UTF-8 bytes, not characters. It also includes the link, the image address, your extra data and about 260 bytes (Android) or 330 bytes (iOS) of Oricato’s own keys.

Script Approximate bytes per character
Latin (English, Spanish, French, German, Portuguese) 1
Arabic 2
Devanagari (Hindi), Japanese, Chinese, Korean 3
Emoji 3 to 4

A body that fits easily in English can exceed the limit in Hindi or Japanese. When any translation is over, the API rejects the message with 422 payload_too_large, and details.payloads[] shows the bytes and the limit for each language and platform. In the dashboard, the size meter shows by how much a language is over.

Step 3: Set the default language

The default language is the one people get when their language has no translation, and when their language is unknown (und).

  • Dashboard: each project has a Default language (Project settings), and new messages start with it. In the composer, the default tab is marked with ★. To change it for one message, open the language’s menu (Language options) and click Make default. You can’t remove the default language from a message.
  • REST API: set content.default_language. It must be one of the message’s translations.

Pick the language most of your audience can read. For global apps that is often en.

Target people by language

To send only to some languages, use the audience filters. In the dashboard, add the Language filter in the audience section and choose is any of or is none of. In the API, use include_languages or exclude_languages (up to 200 codes each, normalized by the server, and they can’t overlap):

{
  "audience": { "include_languages": ["es", "pt"] }
}

A message aimed only at Spanish and Portuguese speakers can then carry just the es and pt translations.

Coming from OneSignal

The OneSignal-compatible endpoint, POST /api/v1/notifications, accepts headings, contents and subtitle keyed by language. Oricato normalizes the keys, so zh-Hans becomes zh-hans and pt-BR becomes pt:

{
  "app_id": "<ORICATO_PROJECT_ID>",
  "included_segments": ["Test Users"],
  "headings": {
    "en": "Your lesson is ready",
    "pt-BR": "Sua lição está pronta",
    "zh-Hans": "你的课程已准备好"
  },
  "contents": {
    "en": "Take five minutes to practice today.",
    "pt-BR": "Reserve cinco minutos para praticar hoje.",
    "zh-Hans": "今天花五分钟练习一下吧。"
  }
}
  • contents is required and can’t be empty. A key that is not a language code returns 400 with “Language ‘…’ is not supported”.
  • If two keys normalize to the same code (for example pt and pt-BR), the first key in sorted order wins and the response lists a warning.
  • A headings or subtitle key without a matching contents key is ignored, with a warning.
  • The default language is your project’s default language if contents has it, else en if present, else the first key in sorted order.

See Migrate from OneSignal for the rest of the field mapping.

Step 4: Test-send each language

The server picks the translation from the language the test device reports, so test each language with a device that shows your app in that language.

  1. On a test device, switch your app to the language: in your app’s language screen, in the per-app language setting (Android 13+ and iOS), or by changing the device language.
  2. Open the app once and bring it to the foreground. The SDK reads and reports the language at that moment.
  3. In the dashboard, open Audience, find the device and check its Language column.
  4. In the composer, click Send test and pick the device. Or create the REST message from Step 2 with "audience": { "test_only": true }.
  5. Check the notification on the lock screen and in the notification shade, collapsed and expanded.
  6. Repeat for each language you added, including the default.

Verify it works

  • Audience: the Language column and the subscriber details show each subscription’s stored language. The summary shows your Top languages. You can filter the list by Language.

  • Composer: the missing-translations alert under Languages shows how many people would get the default version instead of their own language.

  • Estimate API: POST /api/v1/audience/estimate returns by_language, the number of people per language for an audience:

    curl -X POST "<ORICATO_API_ADDRESS>/api/v1/audience/estimate" \
      -H "Authorization: Bearer $ORICATO_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{ "audience": { "include_languages": ["es", "pt"] } }'
  • Message report: after a send, the report’s Languages tab (by_language) shows sent, failed, delivered, opened and open rate for each subscription language.

Troubleshooting

Everyone gets the default language

  • The app doesn’t report a language yet. Check that Oricato.initialize runs on every launch, then open the app once. The language is observed while the app is in the foreground.
  • The app language and the phone language differ. For example, the phone is in English and your app is in Spanish through its own picker. Call setLanguage with the language your app shows.
  • Flutter reports the device locale. Without setLanguage, the Flutter SDK sends the device locale, not the locale your app resolved. Add the LanguageReporter from Step 1.
  • iOS reports the development language. Bundle.main.preferredLocalizations only returns languages your app is localized into. If the app has no Spanish localization, a phone set to Spanish reports your development language. Add the localization or call setLanguage.
  • The language is und. An invalid code passed to setLanguage behaves differently per SDK. Android sends und without logging anything. iOS logs a warning and sends und. In both cases that person gets the default language. Flutter logs a warning, clears any earlier setLanguage value and follows the app locale. Pass a code such as es, pt-BR or zh-Hant.

Chinese speakers get the wrong script

Oricato stores Chinese as zh-hans (Simplified) or zh-hant (Traditional). zh-TW, zh-HK and zh-MO count as Traditional, and plain zh counts as Simplified. If a message has only one of the two, both groups get it. Add both translations when you serve both groups.

A translation has no title or subtitle

There is no per-field fallback. If you leave the title empty in one translation, people in that language get a notification with no title. The subtitle is shown on iOS only. Android never shows it.

422 payload_too_large for one language

Scripts outside Latin use 2 to 3 bytes per character, and emoji up to 4. Shorten that translation, or reduce the extra data or the link, which every translation carries. The size meter or details.payloads[] shows which language and platform is over.

Arabic text looks out of order

Android and iOS lay out right-to-left text for you, including the mirrored app name and time. Problems usually come from a line that starts with a Latin word or a number, which can make the system treat the whole line as left-to-right. Start Arabic copy with an Arabic word where you can. If you can’t, add a RIGHT-TO-LEFT MARK (U+200F) at the start. Then check it with a test send to a phone set to Arabic.

A language disappeared after I removed it

Removing a language from a message deletes its title and message text. People in that language then get the default version. You can’t remove the default language. Make another language the default first.

Related

Get early access to Oricato.

Founding teams get early access, free help moving from OneSignal, and a founding discount.

We use this to reply, plan your invitation and set up your account. Privacy Policy

A person reads every request.

Or get the monthly newsletter