Testing the app

To test the app, from the root of the application folder, run this:

$ npm run dev
or
$ yarn dev

This will launch our application. From the home page, click on Create Thread and create a new thread named Translate API Test or any name you want. Once we create a new thread and navigate to the view thread page, we should see the translate button next to each text message:

Next, when we click on the Translate button, we should see a popup where we see the original message and a selection for translated language. When we pick a language and click on Translate, we should see the translated message, as shown here:

I have translated the text to Bengali.

Do note that this translation for this message will be saved in database. Next time, we are not going to make an API call but display from database.

In our application, we conveniently don't have an edit message feature. So, as long as the message is in our database, the translation is still valid. You can try other languages and test the complete flow end to end.

Keep an eye on the number of API requests you are making to Cloud Translate API.

To wrap up this chapter, we are going to push the code to Heroku.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.9.197