Skip to end of metadata
Go to start of metadata

Summary

Liferay's localization is great feature, but it has its own limitation in web content translation support. Authors need to create web contents for different languages manually. With this app we automate that process. We make calls to an external translation service and store the translated content in the same way Liferay does. At this moment we use Yandex.Translate, which is a free API: https://tech.yandex.com/translate/.


Overview

This application offers the possibility to add automatic translations for Liferay's Web Content, it is completely integrated in the existing Web Content editor and the new translations added are integrated with Liferay's versioning and workflow services.

When the application is installed a new button "Automatic Translation" will appear next to Liferay's "Add Translation"

When you click on the button "Automatic Translation" a new dialog will be displayed where you can select one or more languages. This dialog will show only the languages that are supported by both the Yandex.Translate API and the current Liferay configuration.

After selecting the desired languages and click on the "Continue" button, the new translation(s) should be listed as regular Liferay's translations:

This feature will work exactly the same in complex Web Content that uses Liferay's structures and templates, in this case only the fields with text content will be translated.

After adding a translation, a new version will be created and the Web Content will be marked as a Draft.

Installation

The installation steps are as follows:

  1. Obtain the Content translator application from the Liferay Marketplace.
  2. Deploy the application in your existing Liferay installation. If you haven't already installed Liferay, please download and install from www.liferay.com.

  3. The Content translator should be available while editing any Web Content.

Configuration

The only configuration needed for the application is to set a valid credential for the Yandex.Translate API, if you don't have an account yet please follow this instructions:


StepsImages

Click "API key"

Log in or register on Yandex

Accept the user agreement to generate an API key.

To recover a key, you can click on "My Keys".

Copy the generated API key


StepsImages

After obtaining the credentials configure them in the Control Panel:

Under Control Panel, under Configuration, select "System Settings"

Search for "Automatic Translator Configuration" and select it.

Provide the API key, and then click Save


Additional Considerations

There are some languages that may generate characters not supported by some databases using certain configuration, for example the default configuration that Liferay uses to connect to MySQL forces UTF-8 encoding that may lead to Exceptions when trying to add a translation in languages such as Japanese, in the case of MySQL this can be solved changing the connection string in the file portal-ext.properties like this:


Locate the JDBC connection string:

jdbc.default.url=jdbc\:mysql\://localhost/lportal?useUnicode\=true&characterEncoding\=UTF-8&useFastDateParsing\=false


Remove the characterEncoding\=UTF-8 parameter:

jdbc.default.url=jdbc\:mysql\://localhost/lportal?useUnicode\=true&useFastDateParsing\=false


The server needs to be restarted after the change.

Code repository

The latest source code is located at the following location:

https://github.com/rivetlogic/liferay-content-translator


Contact Us

We welcome feature/bug reports concerning the Content translator app. Discussion helps clarify the ways the app can be used and also helps define directions for future development. Please post your concerns at http://issues.rivetlogic.com/browse/LRA

Change Log

2.0.0
Liferay 7 version

1.1.0

Company credits.
  • No labels