Skip to main content

Drupal Integration

Translate your Drupal website using Transifex's plugin and TMGMT.

Written by Transifex

The Transifex module for Drupal 10.3 and 11 connects Drupal's Translation Management Tool (TMGMT) to Transifex. You send content from Drupal to Transifex, translate it there, and automatically bring the translations back to your site.


Before you start

You will need:

  • Drupal 11, or Drupal 10.3 or later

  • The TMGMT module, version 1.19 or later

  • A Transifex project and an API token

  • Composer access to your Drupal site

If you're on Drupal 10.2 or older, we recommend upgrading to Drupal 11, or at least Drupal 10.3.


Setting up the Drupal integration

Step 1: Prepare your Drupal site for translation

  1. Install and enable TMGMT.

  2. Go to Configuration > Region and language > Content language and translation and mark which content types should be translatable. Once done, save your configuration.
    ​

  3. Go to Configuration > Regional and language > Languages and add your target languages. Once done, save your configuration.
    ​

Step 2: Install the Transifex module

Install the Transifex module with Composer:

composer require 'drupal/tmgmt_transifex:^2.1'

Then enable it under Extend. On Drupal 10.0 to 10.2, install version 2.0.8 instead.

Step 3: Connect Drupal to Transifex

  1. Go to Translation > Providers and click Edit next to Transifex.
    ​

  2. Fill in Label and Description (optional), and make sure Transifex is selected as the provider plugin.
    ​

  3. Enter your Transifex API token and choose the Transifex project to use. You can create a Transifex API token by following these instructions.
    ​

  4. Map each Drupal language to its Transifex language code under Language mapping.
    ​

  5. Choose how translations come back to Drupal with Auto accept finished translations and Pull only when a language is 100% reviewed. See the table below.
    ​

  6. Click Save

How translations come back to Drupal

Two settings decide when translations return to Drupal and whether they need a review there. The behavior is the same for manual and continuous jobs.

  • Auto accept finished translations (provider settings): translations are published straight to your site. When it's off, Drupal creates a review job instead.

  • Pull only when a language is 100% reviewed (provider settings): Drupal waits until a language is 100% reviewed in Transifex, not just 100% translated.

Auto accept

Pull only when 100% reviewed

When a language is 100% translated

When a language is 100% reviewed

On

Off

Published to your site

Published to your site

On

On

Nothing happens yet

Published to your site

Off

Off

Review job created in Drupal

Review job created in Drupal

Off

On

Nothing happens yet

Review job created in Drupal

Step 4: Set up the webhook

The webhook tells Drupal when translations are ready, so they sync without manual checks.

  1. In Transifex, open your project and go to Settings > Webhooks.
    ​

  2. Add a webhook by clicking Add webhook with the following URL:
    ​

     https://<your-domain>/tmgmt_transifex_callback

  3. Add a secret key and set Event to All events.
    ​

  4. Set the webhook status to Active and click Save Changes.

  5. In Drupal, go back to the Transifex provider settings and paste the same key into the Transifex webhook secret.
    ​

Step 5: Send content to Transifex

You can send content to Transifex in two ways. Use a manual job for one-off batches, like a new landing page. Use a continuous job to keep content in sync as your team publishes and edits it.

Send content with a manual job

  1. Go to Translation > Sources.

  2. Select the content you want to translate. Use the filters to find it by content type or language.

  3. Choose one, multiple, or all target languages and click Request translation.
    ​

  4. On the checkout page, select Transifex as the provider and click Submit to provider (for one language) or Submit to provider and continue (for all or multiple languages).
    ​


    When sending multiple jobs, you can submit them all at once with the same settings instead of one by one.

Each content item becomes a resource in your Transifex project, ready for translators. You can follow the job's progress under Translation > Jobs.

Send content with a continuous job

A continuous job automatically sends new and updated content to Transifex, so you don't need to request translation each time.

  1. Go to Translation > Jobs and click Add continuous job.
    ​

  2. Give the job a label, choose the source and target languages, and select Transifex as the provider.

  3. Choose which content types the job should include.

  4. Click Save.
    ​

From then on, when you create or update content of those types, Drupal adds it to the job and sends it to Transifex. Continuous jobs rely on cron, so make sure cron runs regularly on your site.
​


Review translations in Drupal

If Auto accept is off, open the translation job in Drupal and click Review. New translations are highlighted. Check them, then click Save as completed to publish.


💡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?