If you want to offer translation on-the-fly, whether it's as short as a chat message or as long as a news article, and deliver it to any number of subscribers, in realtime, PubNub Functions lets you do it.
Select from a list of pre-built Functions, or build an integration with a service of your choice. Here are a few suggestions:
- IBM Watson Language Translator provides an API for translating and publishing text for 11 different languages.
- Amazon Translate removes the complexity of building translation capabilities into your applications with a simple API call. This makes it easy to localize an application, or process multilingual data within your existing workflows.
- Microsoft Translator is a cognitive services offering from the Microsoft Cloud and Enterprise division. It provides a scalable, compliant, and customizable neural machine translation cloud service that supports over 60 languages.
Some Blocks require third-party service signup
When Blocks integrate with third-party services, such as Amazon, Librato, MapBox, or RingCentral, the services often require account setup to use them. Please make sure to visit each Block's documentation page, located in the Blocks Catalog, to learn what's required.
IBM Watson Language Translator Tutorial
The IBM Watson Language Translator provides an API for translating and publishing text in 11 different languages.
IBM Watson Function Code
Getting started with the Watson APIs
First, you’ll need to get started with a Bluemix account to take advantage of the Watson APIs.
Sign up with the Bluemix signup form.
Open the IBM Watson Language Translator API page, and add it to your service dashboard.
On the service credentials pane of your new service instance, make a note of the username and password.
Setting up the PubNub Function
Next, set up a PubNub Function to get your code running on the network.
Create a new function. Go to your PubNub Dashboard and create a new module, and then create a new Before Publish function. The function should be set up to trigger on a specific set of channels (such as
chat.*) or on all channels using wildcards (
passwordconstants with your Watson credentials from the last Watson setup step above. Update the
langsarray with the languages you want to use, and click the red Save button.
Click Start module to start the function, and test it using the Test Payload field and Publish button on the left.
For a more detailed overview of writing a function, refer to these instructions on the Functions Overview page.
This function enables communication between multiple participants in their native languages. It supports English, French, and Spanish, but you can support additional languages by adding them to the
A message is sent to the input channel. Then it's translated using the IBM Watson API while the message is in transit. The published message is appended with a translation before it reaches subscribers.
Input: Publish a message text on the input channel.
Output (Spanish): The text is translated and added to the message payload.