Drupal 8/9/10 users can use Drupal's Translation Management Tool (TMGMT) Module to manage translations within Drupal.
By installing the tmgmt_smartling module, you can use Smartling as a translation provider in TMGMT.
Install the TMGMT Smartling Module
To use the TMGMT Smartling module, you first need to install the TMGMT module and all of its dependencies.
- Go to the TMGMT Translator Smartling page and make sure to download the latest release of the 8.x-4.x branch. You'll be given the option to download a
tar.gzfile or a .zip file. Make sure you download the
- Select Extend and click +Install new module.
- Enter the file
tar.gzURL or upload it and click Install.
- You'll now need to install all of the dependencies for the Smartling Translator. To do this, repeat steps 2 and 3 for each of the following: TMGMT (latest release of 8.x-1.x branch) and TMGMT Extension Suite (latest release of 8.x-3.x branch).
- Once you've installed the new module and all of its dependencies, scroll down to Translation Management and enable the following modules:
- Content Entity Source:
- Config Entity Source (if you need to translate drupal configs like field labels etc):
- Locale source (if you need to translate UI translatable strings):
- Content Entity Source:
Set Up the TMGMT Smartling Module
- Select the Providers tab and click + Add provider.
- In the Label field, enter the name for the translator. For example, Smartling Translator.
- Check Auto accept finished translations if you want to automatically publish translations returned from Smartling. (If you do not check this box, you will need to review translations in Drupal before they are published on your translated sites.)
- From the Provider plugin drop down, select Smartling translator.
- You should now see the Smartling Translator Plugin Settings shown here:
- In the Smartling Translator Plugin Settings, enter info for the following fields:
- Project ID: The project ID for the Smartling project you are using for your Drupal translations.
- User ID: User's unique identifier for Smartling API.
- Token Secret: User's secret token for Smartling API.
The Project ID, Key can be found within your Smartling project. The user ID and token secret are issued when the API key is generated in the Smartling account. Go to Smartling > Projects > Project Settings > API.
- Username for context retrieval: To get context for your translations, the Connector impersonates a Drupal user. Different users may have different permissions that enable them to see different components of a page. Keep this in mind when you choose a user for context. Example: admin.
- Context silent user authentication: some external modules may react on user login/logout events and interfere with the context generation process. If enabled connector will impersonate to context user silently without emitting the mentioned hooks.
- Skip host verification: it’s often that dev/stage envs do not use SSL connections so this option disables certificate check while context retrieval process. Use only for developing and testing purposes on NON PRODUCTION environments.
- The desired format for download: Select the type of translations you want returned. You can either return only translations that are published or pre-published in Smartling, or return any saved translation even if they are not published (for example if the translation is currently in an editing step). For testing, you can choose to return a modified version of the original text with extra characters, so you can check that your layout can handle a translation that takes up more space than the original text.
- Automatically authorize content for translation in Smartling: If checked, when you submit translations, content will automatically be authorized instead of being added to your Awaiting Authorization queue.
- Use Smartling callback: You can have Smartling send a callback to your Drupal instance to download translated items as soon as they become available, rather than waiting for the scheduled download process to pick them up. For this to work, your instance must be publicly addressable.
- Download method: A list of available locations where exported files can be stored. The usage of a protected location (e.g. private://) is recommended to prevent unauthorized access.
- Custom placeholder (regular expression): The content matching this regular expression will not be editable by translators in Smartling.
- Comma-separated list of HTML attributes to be translatable: instructs smartling parsers that text inside of listed html attributes is translatable.
- Enable Smartling remote logging: connector related logs will be sent to smartling if enabled. Needs for troubleshooting purposes
- Enable Smartling real-time notifications: connector adds “see smartling messages” permission which allows users with this perm to see smartling related messages in popups on the site (notifications about downloading/uploading files, context sending and failures if any)
- Asynchronous mode: if enabled then connector won’t immediately submit content for translation but will put it into the cron queue instead. Usually disabled.
- Enable basic auth for context: Enable this option if you have basic auth set up on your web server. It’s needed for context feature and useful when content is submitted from dev/stage site instances that are secured by basic auth.
- Download and apply translations per job item: if TMGMT Job contains a lot of TMGMT Job items then it may take some time to download and apply translations. Enabling this option will make the connector download and apply translations by TMGMT Job Items so there will be no execution timeouts. Only enable if you experience download execution timeout issues.
In Remote Languages Mapping: Once you have set up your languages in the TMGMT Module, you will see an entry for each language here.
Enter the corresponding Smartling locale code set up in your project. For example, de-DE for German (Germany) and click Save. (The language must be set up in your Smartling Project. To retrieve the locale codes in your Smartling Project, go to Smartling > Projects > Project Settings > API > Languages.)
- Once you've saved the new provider, scroll to the top of your page and return to Providers.
- If the Smartling translator doesn't appear as the first entry in the list, click and drag it to the top of the list to make it your default provider. Click Save.