TMGMT Drush Helper runs the whole Translation Management Tool (TMGMT) workflow in bulk from the command line. You can find what still needs translating, stage it in jobs, send the jobs to a provider, import and accept the translations, and clean up afterwards, without clicking through hundreds of jobs in the UI.

It does not use the TMGMT cart. The cart keeps its contents in the browser session, which a Drush process cannot see. The module creates real TMGMT jobs with job items instead, so they appear right away at /admin/tmgmt/jobs.

Features

  • Find untranslated content: tmgmt:scan-untranslated reports, for each entity type, bundle and language, what has no translation, what content_translation flags as outdated, and what is already waiting in a job. It covers nodes, taxonomy terms, media, menu links, custom blocks (block library and Layout Builder inline blocks) and webforms.
  • Stage content in bulk: tmgmt:job-batch-add creates jobs for any translatable content entity type, for webforms and other config entities (with tmgmt_config), and for interface strings (with tmgmt_locale). It can:
    • queue only what is untranslated (--missing-only);
    • skip content already in a job (--skip-existing);
    • also queue the taxonomy terms and Layout Builder blocks a page references (--include-references);
    • split the work into jobs of a set size (--items-per-job).
  • Exclusion list: a settings page lets administrators exclude entity types or bundles. The scan and --missing-only then leave them out.
  • Assign providers: tmgmt:job-update sets the provider and its settings on jobs that have not been submitted, including jobs whose provider no longer exists.
  • Submit to any provider: tmgmt:job-submit-all submits pending jobs and takes the provider's checkout settings as JSON.
  • Lionbridge support: the optional tmgmt_helper_contentapi submodule integrates with the Lionbridge Translation Provider:
    • tmgmt:job-submit-lionbridge sends jobs with their Lionbridge settings: provider, due date, PO reference, quote, analysis codes and export format.
    • --resubmit sends again jobs that Lionbridge never received.
    • tmgmt:job-import fetches finished translations from the Lionbridge Content API.
    • A "LionBridge Job ID" column is added to the jobs overview.
    • Deleted jobs are removed from the Lionbridge send queues, so they no longer stop cron.
  • Accept and finish:
    • tmgmt:job-accept-all accepts imported translations.
    • tmgmt:job-finish-accepted moves fully accepted jobs to Finished. It can also abort items whose source content was deleted.
  • Clean up: tmgmt:job-delete-all deletes jobs by state, owner or ID. It aborts active jobs with their provider first.
  • Links to the source: on a job's page, each job item links to the content being translated, if it still exists and you can view it.
  • Safe to try: every command supports --dry-run.

Typical workflow

# See what still needs translating.
drush tmgmt:scan-untranslated --target-langcodes=es,fr

# Stage what is untranslated, with the terms and blocks it references.
drush tmgmt:job-batch-add node --target-langcodes=es,fr --missing-only --skip-existing --include-references

# Send the jobs (tmgmt:job-submit-all for providers other than Lionbridge).
drush tmgmt:job-submit-lionbridge --provider=my_provider

# Once the provider has finished, import and accept the translations.
drush tmgmt:job-import
drush tmgmt:job-accept-all

Requirements

Recommended modules

  • Lionbridge Translation Provider: needed by the tmgmt_helper_contentapi submodule. All other commands work with any TMGMT provider.
  • TMGMT's Config Entity Source (tmgmt_config): to queue webforms and other config entities.
  • TMGMT's Locales Source (tmgmt_locale): to queue interface strings.
  • Layout Builder and Paragraphs: --include-references follows the blocks and terms they reference.

Installation and configuration

composer require drupal/tmgmt_helper
drush en tmgmt_helper
# Lionbridge only:
drush en tmgmt_helper_contentapi

To exclude entity types or bundles from the scan and from --missing-only, go to Administration » Translation » Settings » Drush helper. This needs the "administer tmgmt" permission. Run drush help <command> for every option, and see the README for full documentation.

Security

The Drush commands bypass entity access checks so they can work on all content. Limit who can run Drush on your servers.

Supporting organizations: 
Initial Development, Testing, Maintenance

Project information

Releases