Translate push notifications

Updated

Translate push translations

Push notifications work in conjunction with the translation feature. If a user enables the auto-translate feature and sends a message, the SDK will send both the original message and the translated message.

A recipient can set the preferred language for push notifications. If the language of the translated message matches their setting, the translated message is displayed in the push notification bar; otherwise, the original message is displayed.

The following sample code shows how to set and get the preferred language for push notifications:

Push notifications work with the translation feature. If a user enables the automatic translation feature and sends a message, the SDK will send both the original message and the translated message.

As a recipient, the user can set the preferred language for push notifications they want to receive when offline. If the language of the translated message matches their preferred language, the translated message is displayed in the push notification; otherwise, the original message is displayed.

Call setPushPerformLanguage to set the preferred language for push notifications. The sample code is as follows:

// Set the preferred language for push notifications.
const params = {
  language: "EU",
};
chatClient.setPushPerformLanguage(params);

// Get the preferred language for push notifications.
chatClient.getPushPerformLanguage();