Auto Translations
Last updated
Last updated
Starting with version 3.7 of Publisher, you can automatically translate your content using the DeepL or Google Cloud Translation services directly in the ExpressionEngine control panel, and without having to update your templates!
Publisher's direct implementaion with external translation services means your translated text is saved in the ExpressionEngine database, just like all other content. Once a translation is requested, you will have the opportunity to review and finesse the translation as needed before saving it, and presenting it to your users on the front-end. This greatly reduces API calls and gives you ultimate control and flexibility of your translations.
If using DeepL, you will need to create an account and get an API key with access to the REST API. Your API key should end with :fx
.
If using Google, you will need a Cloud Translation API key available in your Google Console. Publisher only supports V2 of Google Cloud Translation. For simplicity sake, Publisher does not support V3 of Google Cloud Translation.
The auto translation feature has been tested, and works with the following fieldtypes:
Any Text, Textarea, and RTE fields
Bloqs (5.0.2 minimum version)
Grid
Reel
Simple Grids & Tables
Basically, it works with any fieldtype that saves text strings, even if it's in a JSON object.
If you are viewing an entry in a non-default language, and no translation exists for that language, then you will be given the option to auto-translate it. In this scenario, clicking the "Yes, translate it" button will reload the current page without saving it, make multiple API requests to translate each text string, then display the translated text in the ExpressionEngine publish page.
After you click the translate button the page will reload displaying the translations, and will notify you of this status. At this point you can make any minor modifications to the translations or other content, then you will need to save the entry in order to save the translation in ExpressionEngine.
Once the translation is saved in ExpressionEngine, you will see an option to re-translate it. If in the event a new custom field is added to the entry, or content is updated, you can click this button to request new translations. Note that this does not save the entry before re-translating it. You will first need to make any necessary updates, save the entry, then click the re-translate button, then once the page reloads with the newly translated content, you will need to save the entry one more time.
In an effort to save API requests the translation option requires manual intervention, thus both the "Re-translate" and "Yes, translate it" buttons simply reload the page with an ?translate=y
parameter in the URL. This indicates to Publisher that it should make requests to translate what it is about to load into the entry on the publish page. Publisher will also cache responses from DeepL for up to 1 hour, so multiple translation requests won't greatly affect your API usage.
If you are using DeepL you can define a Phrase Group as a glossary. A glossary is a pre-defined list of words or sentences that are translated exactly how you define them. The translation service will use your definitions instead of their automated translations. Glossaries are ideal when you do not want to translate, or you want to finesse translations, such as product names, trademarks, or other key phrases on your site. For example, if you have the following sentence in English, where "law and order" words are in your glossary, they will not be translated.
"Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs."
In German, it will translate to:
"Chuck Norris verklagt derzeit NBC und behauptet, Law and Order seien geschützte Namen für sein linkes und rechtes Bein."
Automated third-party translation services are not perfect. DeepL is probably the best natural translation service on the market, and even then it may not be as good as if a linquist was typing out the translation themselves. By using the Auto Translation option in Publisher you are acknowledging that the translation quality, and HTML formatting, itself is not related to Publisher. If you are translating text that contains HTML, such as a wysiwyg field, you may need to review and correct any formatting from the translation.