Google translate API integration

Hi everyone,

We’re working on adding a language translation feature to our Liferay DXP 2024.Q1 portal and would love to hear from anyone who has tackled something similar.

What we’re trying to achieve

The reference experience we’re aiming for is similar to mumc.nl a styled language picker button in the header that, when a language is selected, serves the page and next pages already translated (after a first reload). No flash of untranslated content, language preference retained across navigation. Therefore we would need to translate before the render.

Solution

My first thought was some sort of server-side filter that can send the html through a translation service (with cached data ofcourse, and removing cache after an update of the content through a modellistener). However, we do use SPA and some dynamic /async content so this a bit tricky, and therefore assume we will need something hybrid still. I.e. a js module with a translation server endpoint. Obviously we would use a client extension or fragment for the language picker in the master page. The customer does not want to translate the content itself (because it is too much work), they want to use google translate dynamically.

Any input is very welcome!

Thanks!

2 Likes