Drupal 8/9/10

Translate your Drupal 8, Drupal 9 and Drupal 10 site using Transifex's plugin and TMGMT.

Nina avatar
Written by Nina
Updated over a week ago

Transifex's Drupal integration lets you translate your Drupal site using Transifex. It works as an add-on to the Translation Management Tool (TMGMT), a popular module for Drupal localization.

We assume the starting point is a Drupal site with content already available in one language (source language). This guide will cover:

1. Globalization step: getting your Drupal site ready to be localized

  • Installing the TMGMT plugin for localization

    1. Marking which content you want to localize

    2. Selecting languages to localize your content to

2. Linking your Drupal site with Transifex

  • Adding the Transifex plugin in Drupal and configuring it

3. Localizing Drupal content using Transifex

  • Selecting content for localization (we support every content type that Drupal passes to the translation module. Depending on the content type, if this is not supported natively, you may need to use a plugin for i18n support)

    1. Monitoring localization progress

    2. Getting localized content back and making it available on your Drupal site

4. Setting up an auto-update webhook with Transifex


Globalization step

First, get your Drupal website ready for localization. Since version 8, Drupal natively supports localization by including a TMGMT module in its core distribution. This module enables localization options for a Drupal website.

Marking which contents to localize

  1. Visit the Drupal admin interface and go to Configuration > Content language and translation (grouped under 'REGIONAL AND LANGUAGE' widget)

    regional_and_language.png#asset:6129

  2. You'll see a list of all localizable content. Check the content that you would like to localize (more details: https://www.drupal.org/docs/8/multilingual/translating-content)

    drupal_content_language.png#asset:6130

Selecting the target languages

  1. Head to Configuration > Regional and language and choose Languages to add languages you want to localize to (i.e., target languages)

    drupal_regional_language.png#asset:6131

    This is where you can add the languages.

    drupal_target_languages.png#asset:6132

  2. Click + Add language to add a language from the list.

    drupal_add_language.png#asset:6133

    Or choose Custom language to add a custom language.

    drupal_custom_language.png#asset:6134

  3. In the list of languages, if you click Edit, you'll see its language code and name and define it as a 'Left to Right' or 'Right to Left' language.

    drupal_lang_code_name_direction.png#asset:6135


Linking your Drupal site with Transifex

  1. Install the module on your Drupal site:

Setting up localization with the Transifex plugin

  1. Go to the Translations tab.

    drupal_translations_tab.png#asset:6136

  2. Go to Providers.

    drupal_providers.png#asset:6137

  3. Click Edit on the Line labeled Transifex to set up the provider.

  4. In this form, you can edit the provider settings.


    drupal_provider_settings.png#asset:6138

    Label & Description fields are a help text, so add something basic and descriptive.

    Provider plugin is where you pick any available translation services. If another localization plugin is available, it will be listed here. Choose Transifex.

  5. Provide the necessary information to link the Drupal website with your Transifex project.

    drupal_transifex_plugin_settings.png#asset:6139

  6. Next, move to the language mapping.

    drupal_lang_mapping.png#asset:6140

    Each label locale represents the locale that Drupal uses for the language; each dropdown selection represents the locale Transifex is using.

    Once you're done setting the Remote language mappings, hit Save to update the provider setting.


Sending content to Transifex

Now that the configuration process is done, you can send content from Drupal to Transifex for translation.

In Drupal terminology, these localization requests are called Jobs.

  1. In the Drupal admin interface, go to Translations. The Jobs tab contains all the translation requests sent to translation providers.

    drupal_job_overview.png#asset:6141

  2. Click on the Sources tab. This is where you can see a list of all your translatable Drupal content.

    drupal_translatable_content.png#asset:6142

  3. Choose the content you are interested in, and choose the Source Language and Target Language from the dropdown (you can select more than one target language).

    drupal_translatable_content_2.png#asset:6143

  4. After this, click the Request translation button to send the translation content in Transifex.

    You will see a progress bar, Submitting Jobs, and a few notifications will appear.

    drupal_notifications.png#asset:6144

  5. This way, the content was pushed to Transifex as resources. Opening Transifex, you will see the created resource files with the same name as the Drupal content.

Previewing translation jobs progress in Drupal

Transifex and Drupal do not communicate in real time about translation services. So, to check the status of your translation Jobs, you need to query the Transifex service.

  1. In the Drupal admin interface, go to Translations. Go to Jobs to see the list of all the translation jobs.

    drupal_list_translation_jobs.png#asset:6146
  2. Select the translation job you're interested in and click on Manage to see its details.

    drupal_manage_details.png#asset:6147

  3. Click on Check for updates in the Provider information widget.

    drupal_check_updates.png#asset:6148

    This action will query Transifex and update Drupal with the translation progress information.

Getting translations from Transifex to Drupal

After the steps from the above section are complete, additional steps are needed to display the localized content on your Drupal site fully.

Incoming localization jobs from Transifex are considered as "need review".

  1. Go to the specific translation Job. The content pushed from Transifex is in yellow and marked as needing Review (in the Operations column).

    drupal_operations.png#asset:6149

  2. Click Review to validate the incoming localization jobs from Transifex. You'll see a list of all the content in the source and target languages.

    drupal_review.png#asset:6150

  3. Click Save as completed - this will review and complete the specific translation job, returning to the translation job overview page.

    drupal_save_as_completed.png#asset:6151

⚠️Warning: Having set up your language selectors for your Drupal site, these actions will make the localized version immediately available on your website!

💡Tip: You can skip the manual review of the incoming changes from the Transifex provider interface. To do so:

  1. Visit the Drupal admin page and go to Translations > Providers.

  2. Choose Transifex and click Edit.

  3. Enable Auto to accept finished translations.


Setting up an auto-update webhook with Transifex

This will enable auto-fetching translations from Transifex once the content sent to Transifex is 100% translated.

  1. Go to your Transifex Project settings > Webhooks and create a new webhook.

  2. In the URL field, add the Drupal domain of your site followed by '/tmgmt_transifex_callback'. Ex. if your Drupal domain is www.mydrupalsite.com, you should add ‘http://www.mydrupalsite.com/tmgmt_transifex_callback’

    drupal_8_webhook_url.png#asset:8264

    Add a custom Secret Key; in the Event field, select All events. Make sure that the Webhook Status is Active and click Save Changes.

  3. Navigate to the Drupal admin page, select Translation > Providers, select Transifex, and click Edit.

    Go to Transifex plugin settings > Transifex webhook secret and add the Secret Key you've added in Transifex.

    drupal_webhook_secret.png#asset:6154

    If you want to get the translated content from Transifex when reviewed, check the related checkbox Pull only when a language is 100% reviewed.


💡Tip

Looking for more help? Get support from our Transifex Community Forum!

Find answers or post to get help from Transifex Support and our Community.

Did this answer your question?