Transifex

  • Documentation
  • Integrations
  • Drupal 8

Drupal 8

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

We assume that 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
    • Marking which content you want to localize
    • Selecting languages to localize your content to

2.Linking your Drupal site with Transifex

    • Adding Transifex plugin in Drupal and configuring it

3.Localizing Drupal content using Transifex

    • Selecting content for localization
    • Monitoring localization progress
    • 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.

Installing TMGMT

https://www.drupal.org/docs/7/extend/installing-modules#import_mod

Marking which content to localize

  • Visit the Drupal admin interface and go to Configuration > Content language and translation (grouped under ‘REGIONAL AND LANGUAGE’ widget)

    l7YxHKXTWDrCGM7kNC4PdToyvGQEdJ9vc6ZjDmwTimd5dQZ6bWrth_mGbQYnomng0QeTlivyMBE6QCWEdeg2IG6uNI9rqETGiw8P6Cpv77Zpm05dEMZjqOcXtackNH8IMKwBgZNe

  • 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)
    _4NCRpILyGOeCaZv0eUXJ9BXc1Uv8VOa8mskxRZPwBGPMxFAjdEoYzwrBsZyvdTbjQ86rY1wsP0ssK4pAzka4D9SAzzsR7niB1sSQ2h2tcpUT0nBFZwx-J6d78VkESL6H3nVe-4Y

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

    W1WNW8Bg8WjPoImO-nY16OKqAhsyvFYNkJgBfaNHzd7rvGjLuuE6e6oHRIhixvf8i0KAJJsaZOZi17PIH2n9MngddyUNKLNCQLjLTlCN62RNN07-BJX0AFyJ_b2wG-AITR_mlVLD

    This is where you can add the languages.

    DuvaM3DSFP-TMF9cZFfY3gs5S-MAfhtptmphCPGROR6SZWNzPjHdWJPYzWBkNV396q2oUmxggMyrcrJcLkTuXi243lKqD3rJ1yBrQ5eL0pwktJU_CPIA2s-3J3W_CVyYoKZoO-dJ

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

    W0CAgAD_NTfzosR3ftPZf0PbqKGa4wyTbjO8W0EKnCHLv90ImYjDN-gky4GzXUVsis6-37adF5aDQ0DzeAFg7fEmsZk3ocPdTtso94Ynb3nfZMN_SJt6q-sqa_LuCQMLOyz6eBjS

    Or choose Custom language to add a custom language.

    oK9fhc54rQon349ViyyttbC493NxaJ6fCADW75AR59KZtxontdyTWX8GSnrnVeK5_dG0bvqHUyrMhQELzPWdreiXN3PdBW9vOr8HR7iHZoEzupXquTnGKW0k6ocUdkfqt7in9sJ7

  • 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.

    fSoVrUFmWsVDAzJfPMPEH5WzI3zZgxPmuVXt_xKqxSU6Y4YHPo_1rlNxbnAu007wj_WZkvkUU3OYwaoJajTniB2T7iN9abHPgvjyDfG7BRNcN-HaPsn3jvG9X5DpzA5EllS-3L61

  • Go to the Translations tab.

    I-XlafiyT5TMj85Hhjee9r4MojRce8iN4MVpitggG23kTciyi6uE0sE3CCojR6hVCN5FJn1BLmn1q2hHl9064cGkUwqp0Ynlx05rPxY5-l0eBRzNNJHZ-nljaE-86_hBGaCeZL5S

  • Go to Providers.

    uNc3p0Il-P_3yNK9Vq4sVjPj-Ljkp4HrdtNIR7KdyrmYthdmF_IltbrriiUsZrT7hM345Xfsf_6CzRXFzQ9CCJWE1cA2HON4XkwORP1g1dYiUJA_G8mJrAGQLqsx9xyO3QV5U25Y

  • Click Edit on the Line labeled as Transifex, to set up the provider.

  • In this form you can edit the provider settings. 

    Ydsg3gy_claQb9Qy4U5PKKhYZeY_sEYXZEYlHafWbCaIvS8IZVtdjwcjxS2MBSU2SOgfmik_E2rCudWjIZqLU6oBIrqfh_xf3N6C82C8zbjHEqksIlyMSYxW3EAd26GTvbwNuEg5

    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.

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

    20NOugy4CFtZmG_EW51Y2KbCRGKZrkh_FdpXUl1AbKQhpk1mOtQnnrEuIUSmb_9urB32dKpz8bSEvLboYSFNsPdvTdTjN6GAwB14ZUUJZmqaFV3-4Q26TyNzbkPetKiFRhtUiaTg

    (See How to get your Transifex API token)

  • Next, move to the languages mapping.

    rM9b-N6e6eJpYme-H618KPIESS_uqPsS1zm6QXOoouwBQhz-jAJh-Rpgi333O0nyyT7tR3ZAHEGuSX4GGq-p-MrbpdKtQHfIu3GfajS9E9pxVMIOtfnkALRaECeOU2MHWckGAJ1P

    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're ready to send content from Drupal to Transifex for translation. 

In the Drupal terminology, these localization requests are called Jobs.

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

    9iUHE2zdPOMfAumh3wRTD1XlWKG2cyT4PbkeXHNMhs6YPcnYXiqb09IAW1U8mUqV-wrl5CxiVLo7LZJCiYN1vrQS8KTE0zy3UV1OekcsLAQh9C3w0YG9DlZiYHpUvkOzenQqH_qv

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

    uTc5yFufzNuO1tYA-xFR0SCIN9k9Xn8XbyU6CISoof3sAbJC1puNvNL-U6DYTwR8Wl0evPrzTe8N47UUjUZ7Sdv-SBBkh-ekIGkxsM_HOLsuK7Fo3dx85zyOgeSfpBghUozYxM9V

  • Choose the content you are interested in, choose the Source Language and Target Language from the dropdown.UzHNdKhuPmXqxKsHl0gpPjJ8cdScuvhzi0S80386wI6zPUg_rmKQ5yESFJ_T38ZKOhX2SOIQk_5FNL2zECcpB8nADhVi6trvD-Y81gWcOsR07DP8SzpT0jn9d42D53RhgVB3J0E6

  • After this, click the Request translation button to actually send the content for translation in Transifex.

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

    Y2WGeYeeUwlbDs3UBUQJjwlaIa93vAdBEJu2sClQumIzEUuugUkfYai54yo3VftzgoGygenFeNNnJ6n5BhbXeKUo68jlpMR9MDd2YUra0uYC5c9TNMlIE9VvgKkBzq-EfntonpF_

  • This way the content was pushed to Transifex as resources. Opening Transifex, you will see the resource files that were created and that have the same name as the Drupal content.

    -T5HPQrhJSA-yy9v7QfetQoUVeYl47haU-nS4Via5RL0Sem1tJIUWNeeXi12ys-pY_gpTI8wgCpj0I-S2MKj_M19xAjAW0CjZIimjwqWKUZuCPsd2FC8Bmxju6H0owb8EvYV8vZY

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.

  • In the Drupal admin interface go to Translations. Got to Jobs to see the list of all the translation jobs.

    rV3A3ELwqHDg34oe_YEZ-UNPZZNUwvn0BS5XIxio41CWz7A6booKknXOD3X4vW-0XduPzUXfDL6RA4yBc4E1pT4mrIZpXc0vXYb8hlLhScFqf3LSHf0pEuhbEG3vAcDJFluo5GYQ

  • Select the translation job you're interested in and click on Manage to see its details.

    Si8n4-_qUtnivC3_me3_ByFb1WMGPGmxFbJS1eVK1ohZDnojKap5DkrBrWP0i8NNEgMbOzEbSPYSTuAhR-4zfVTAjGeK4myWCrRf24UpLyVsaqMz-W9hqkacAGmEDX3g8RuW3SuQ

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

    n8ADywXj_Mv6asI1u5iSR5xorVyyaVAoKC2gMxgG6wI4oQjiSGcft-o3_LkWiUB6Gk_qm_1RfZB9fxK32TtEGB6kGkxn9prvmrUIuRTK2zk7U0cwKOx2XaxvfkxRCQwpyPpZJqQD

    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, some additional steps are needed to fully display the localized content in your Drupal site.

Incoming localization jobs from Transifex are considered as “need review”. 

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

    i5QZL591ZYGfctvzeFco_2HgfFM1cpSPv3OdNiohfCWBLFsldecwFcztSZSvWXkEwjUEvA4v0SDrhAIdqpYT3z84Ghl_VrWJubYvrtZsDcVUjHISV7fTy7MsUav6Y_nzifueG_D-

  • 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.

    p6HrggGPlSbm3tvLonEW-RuXmvXzCm9a6Ztf1B0mLAWgFdcsRwxnMj0FRJnwKq98xRud1Ja7wQkBqBdbhwxlfELWTxMAA0tSSt6xD64kg_hpU5hn9dyKJknEpfxaqYR-aY-p4hJ0

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

    3vjmsEh0FOU_KW5g7wGJpOFzvnaSxUf05fz0Wr9tRjzM9ZuqP1t1iAjyhkeGbPZmICXGYtvHk_1Xy49HsXRAPjmHbXbPAjWwSuqQFjd7B_fz6WlZmqaGQYCJXW1qAwRBsKwNqiaH

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

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 accept finished translations.

YyXO85Mg5RFnNuEwOmAOEPBz34-ufCfvzjY8-jeXEalTCV-bPJQ9HaZRJGIRgs-BKRu25yl3zIO51Tq0Hxzd-FMRHA3_z7DkNU79b99FvtHgF6wSvfwEO9NLJPV0iS29G1jW9YHC

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.

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

  • In the URL field add the Drupal domain of your site followed by ‘/tmgmt_transifex/webhook/’. Ex. if your Drupal domain is www.mydrupalsite.com you should add ‘http://www.mydrupalsite.com/tmgmt_transifex/webhook/’

    5p5Kxi14izlq6GOlXJcws4l7SSZyH91kOQx2c5SdhTgAEiMLi0uxKsZKYpTh_xw6UAYwlrctVChCtYVOrNEh5oZfi6-Cj701EcFvlk2kxLCnb-2XODq1olPvJhtgNhNwb7fUtzkS

    Add a custom Secret Key; in the Event field select All events.

    Make sure that the Webhook Status is Active and click Save Changes

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

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

    fuHXC7gPIKpVt81yN8kGtO85MVth6a_mIu-xGFA3GKDybWbZY7ep7UPMmLsRPq0kt4xwzAU6bsrrosXy76HhVIysH-AXU-Fwa6oaxpZW9UNK8AxWmLmrQTqi6wle5w3-zwwrgfOW

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