Skip to main content
Website Translation Tool (WEB-T)

Drupal tutorial

Introduction

WEB-T is a Drupal extension for automated content translation. To use this extension, you will need to have a Drupal website

Your website should have Drupal version 10 or greater – extension depends on the Drupal 10 core localization modules for translation management, editing and language selection. 

How it works

The extension translates the webpage content when creating a new article or page. You can also pre-translate the existing website content all at once by selecting languages and content types in Configuration > WEB-T Settings > Machine Translation. All translations are saved into your database, allowing you to edit them as regular Drupal content.

  1. Install extension.
  2. Configure translation languages, domains, and translatable content.
  3. Add language switcher to your website.
  4. Get MT provider access
  5. Configure the WEB-T Drupal extension.
  6. Translate content on new page/article creation or pre-translate your existing website content.
  7. Edit translated pages and articles as regular content.
Please note: Websites using WEB-T plugin with eTranslation integration enabled must be published and accessible online from eTranslation service. Translation with eTranslation will not work otherwise.

Install extension

Using Composer 

To install the extension: 

  1. Using console execute the following command in your website workspace: composer require 'drupal/webt:^1.0' 
  2. Open the Drupal administrator dashboard. 
  3. Open Extend. 
  4. Find the WEB-T extension and click the checkbox at the start of the row to enable. 
  5. At the bottom of the page, click Install. 

From installation file (ZIP, TAR.GZ) 

To install the extension: 

  1. Open the Drupal administrator dashboard. 
  2. Open Extend. 
  3. On the top of the page, click Add new module. 
  4. Click Choose File and upload the .zip or .tar.gz archive of the extension. 
    1. ZIP file can be downloaded from WEB-T website (https://website-translation.language-tools.ec.europa.eu/solutions/web-t-drupal_en) or Drupal module repository (https://www.drupal.org/project/webt
    2. Alternatively, you can paste the direct download link in the Add from a URL field. 
  5. Click Continue. 
  6. A success message should be displayed. 
  7. (Optional) Clear cache by opening Configuration>Performance and clicking Clear all caches or by running drush cr command. 
  8. Click Enable newly added modules. 
  9. On the modules list, find the WEB-T extension and click the checkbox at the start of the row to enable. 
  10. At the bottom of the page, click Install. 
drupal-1

Configure translation languages

To configure the translation languages:

  1. Open the Drupal administrator dashboard.
  2. Open Configuration.
  3. Under Regional and language, click Languages.
  4. Click Add language.
  5. Select the language from the dropdown menu and click Add language.
  6. After the language is installed, it will appear in the language table.
drupal-2

Configure translatable content

Decide whether each type of content entity (node pages, comments, custom blocks, taxonomy terms, user accounts, etc.) should be translatable or not. Then, within each entity type, you can decide whether the sub-types (content types for node page content, terms in particular vocabularies for taxonomy, etc.) should be translated.

To configure translatable content:

  1. Open the Drupal administrator dashboard.
  2. Open Configuration.
  3. Under Regional and language, click Content language and translation.
  4. On the top of the page, select the content types you want to translate.
  5. Go through the table and enable Translatable at the start of each row.
  6. At the bottom of the page, click Save configuration.
drupal-3

Add language switcher

To add language switcher to page:

  1. Open the Drupal administrator dashboard.
  2. Open Structure > Block layout.
  3. Decide on the placement (header, footer, primary menu etc.) and click Place block.
  4. Find Language switcher and click Place block.
  5. Configure block by changing title, visibility, and languages.
  6. Click Save block.
drupal-4
drupal-5

Language switcher will be displayed on the webpage in the selected position.

drupal-6

WEB-T settings overview

After you have installed the extension, open Configuration on Drupal administration dashboard. You will find WEB-T Settings under Regional and language settings.

In WEB-T settings you will find:

  • Translation provider – for setting the translation provider authorization information (eTranslation API credentials or Base URL & API key) and selecting machine translation engines. “Advanced” settings for setting timeout and maximum request size for translation provider.
  • Machine translation – for following the translation progress, pre-translation and deleting translations.

Configure WEB-T extension

Open WEB-T settings

WEB-T settings can be found under Configuration > Regional and languages > WEB-T Settings.

drupal-7

Configure translation provider

Before you continue:
You must have an eTranslation or WEB-T compatible translation provider account.
You have obtained eTranslation API credentials or Base URL & API key from your translation provider.
You have configured the translations languages.

To configure the translation provider: 

  1. Open Configuration.
  2. Under Regional and language, click WEB-T settings.
  3. Select the translation provider.
  4. For eTranslation enter the application name and password; for the Custom provider specify the provider's generic MT API URL and API key.
  5. You can change the translation request size later under Advanced.
  6. Click Save.
drupal-8
drupal-8.5

Configure machine translation

To select machine translation engines to use in translation:

  1. In WEB-T settings, open Translation provider tab.
  2. Under Configuration, select the engines from the dropdowns next to the corresponding languages.
  3. Click Save.

Languages that are not supported by the machine translation provider will not have any engines to choose from on the menu. However, they can still be translated manually.

drupal-9

Configure MT notice

To add notice informing users that the content may be machine translated:

  1. Go to Structure->Block layout.
  2. Choose a region that appears on every page, e.g., Header. Note: position of MT notice will not change based on region – MT notice bar will always appear at the top of the page. Click Place block.
  3. Find a block called “Machine translation notice” and click Place block.
  4. Configure block’s visibility settings – for example, by language. Typically, you would select every language supported by your MT provider, except the source language. That way MT notice will be shown for every language that may be machine-translated.

To manually edit the MT notice text for each language, find and update its translation in User interface translation settings.

Translate content

Translate new content

To add and translate new content:

  1. Create a new page or article.
  2. Click Save.
  3. Browser tab will display a loading indicator while the content is being translated. Article will reload.
  4. Click Translate tab to view a list of translated pages.
  5. Click Edit to make changes to the translated content.

If your administration panel language keeps changing, but you wish to keep it in default language, see "Administration panel language keep changing".

drupal-10

Translate existing content (Pre-translation)

You can translate existing content and UI elements in the Machine translation tab of the WEB-T settings. This is useful when you're adding a new language to your website or integrating the extension with a website that already has content.

To translate existing content:

  1. In WEB-T settings, open Machine translation tab.
  2. In the table select the languages.
  3. Under Content types, select the content to translate.
  4. Click Translate.
  5. To view and edit translations, see "Edit translations".

Translating different languages or content types separately can be more efficient.

drupal-11

Edit translations

Translations are created as separate articles, so they can be edited in the same way as the original content.

To edit translated content:

  1. Open Content.
  2. Find the original article and click Translate.
  3. In the list of pages, find the translation you want to edit.
  4. Open Edit tab to update the translation.
  5. After making changes, click Save (this translation) at the bottom of the page.
drupal-12

Edit image alt text translation

To edit image alt text translation:

  1. Open the translated article.
  2. Click on the image and edit the alt text.
drupal-13

FAQ

How to delete translations?

To delete translations:

  1. Open Configuration.
  2. Under Regional and language, click WEB-T settings.
  3. Open Machine translation tab.
  4. Select the languages and content types.
  5. Click Delete translations.

Go to Drupal’s language settings to remove languages completely.

drupal-14a

Content types can be selected under Content types:

drupal-14b

How to remove translation language?

To remove remove language (after deleting associated translations):

  1. Open Configuration.
  2. Under Regional and language, click Languages.
  3. Find the language you want to remove, click Delete.
  4. In the confirmation window, click Delete.
drupal-15
drupal-16

How to change eTranslation timeout and request size?

You can change the translate request size and eTranslation timeout in plugins’ settings under WEB-T settings > Translation provider > Configuration > Advanced.

drupal-17

How to change request size for custom translation provider?

You can change the translate request size in plugins’ settings under WEB-T settings > Translation provider > Configuration > Advanced.

drupal-18

How to update translations after changing translation engine?

To update the existing translations after changing the machine translation engine or translation provider:

  1. Delete the old translations for the specific language, see "Delete translations",
  2. Translate all, see "Translate existing content (Pre-translation)".

Does the extension translate images and media content?

Images and media content must be localized by the user themselves and added into the translated pages.

Will the translation affect website load times?

There is no noticeable difference in load times between translated content and regular articles. If a page is not pre-translated the visitor will have to wait for the translation.

Troubleshooting

Translation doesn’t work 

Websites using WEB-T plugin with eTranslation integration enabled must be published and accessible online from eTranslation service. Translation with eTranslation will not work otherwise. 

To fix this, publish these websites online and make sure these URLs are accessible from outside (e.g. by making HTTP POST requests):

{{WEBSITE_URL}}/etranslation/translation/123

Translation is slow

Translation speed is translation provider dependent. Systems offered by eTranslation are used by a huge number of users. They may be slow at times due to the heavy workload.

The first time the content of any page is loaded it will take some time to translate it. The translation will be saved and returned instantly the next time.

See: "How to change eTranslation timeout and request size?" and "How to change request size for custom" translation provider?

Translation contains errors

Machine translation cannot fully substitute human translators. The translations must be reviewed and edited by a human. The quality of the translation depends on the machine translation engine and provider.

Administration panel language keep changing

If your administration panel language keeps changing when selecting a language from the language switcher, you have to change your Drupal settings, see official Drupal documentation.