Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

TransParse

10 sites Security covered Drupal 10–11
View on drupal.org

This module automatically finds translatable text in your active theme's templates and entity field labels. It makes these strings available within Drupal's translation interface, allowing you to easily translate your site's content.

A Drupal 10+ module that automatically scans the active theme for translatable strings as also as all the Entity labels and makes them available in Drupal's Translation UI (/admin/config/regional/translate).

By default, these strings are only available on the Translation UI only when we visit each (node) page on the related language. This module is like a "string translation warmer".

Features

  • Automatic String Detection: Scans Twig templates for |t filters and {% trans %} blocks.
  • Field Label Extraction: Extracts field labels, descriptions, and placeholders from all entity types (node, block_content, group, taxonomy_term, paragraph) and field_group labels.
  • Drush Integration: Easy-to-use Drush commands for scanning and cache management.
  • Multi-language Support: Works with all the enabled languages on the site.
  • Performance: Caches scan results for fast repeated access.

Limitations

  • At the moment we parse only the active theme. Support for custom paths can be added.
  • Only scans Twig templates and field configurations. Other sources (e.g., custom modules) are not scanned.
  • Does not automatically translate strings; it only makes them available in the Translation UI.
  • Configuration has to be exported into the config folder.

Usage

Initial scan

After enabling the module, run your first scan:

drush transparse:scan

This will:

  • Scan all Twig templates in the active theme
  • Extract field labels from all entity type configurations
  • Extract field_group labels from display modes
  • Register all found strings with Drupal's translation system

Feel free to uninstall the module when you do not need it. This will not affect the translations added.

Drush options

# Basic scan:
drush transparse:scan

# Force fresh scan (clear cache):
drush transparse:scan --force

# Verbose output (show all strings):
drush transparse:scan --verbose

# Scan specific directory:
drush transparse:scan --path=web/themes/custom/MYTHEME/templates/override/content

# Clear cache only:
drush transparse:clear-cache

Drush command aliases

For convenience, you can use these shorter aliases:

  • drush tps - Same as transparse:scan
  • drush tpc - Same as transparse:clear-cache

Managing translations

After running the scan, translations are available in the Drupal UI:

  1. Navigate to: Admin > Configuration > Regional and language > User interface translation
  2. Add translations for any of the enabled languages.

What gets scanned

Twig Templates

The module extracts strings from:

  • {{ 'text'|t }} - Standard translation filter
  • {% trans %}...{% endtrans %} - Translation blocks
  • alt={{"text"|t}} - Alt attribute translations
  • title="{{ 'text'|t }}" - Title attribute translations

Field Configurations

The module extracts from all entity types (node, block_content, group, taxonomy_term, paragraph):

  • Field labels
  • Field descriptions
  • Field placeholder text
  • Field storage allowed values (for list fields)

Field Groups

The module extracts from field_group module configurations:

  • Field group labels from form display modes
  • Field group labels from view display modes

Configuration

The module works out of the box with sensible defaults, but can be configured:

Theme Path

The module automatically uses the active default theme from your Drupal site configuration. No manual configuration needed.

Workflow for adding new fields

When you add new fields or update templates:

  1. Add your field/template with translatable strings using |t or {% trans %}
  2. Run the scan:
    drush transparse:scan --force
    
  3. Verify in Translation UI: Check that new strings appear
  4. Add translations: Translate for all enabled languages

That's it! No code changes needed.

Example Output

$ drush transparse:scan --verbose

Starting translation string scan...

Scan complete!

Summary:
  Total strings found: 152
  Strings registered: 152

Breakdown by type:
  Twig |t filters: 89
  {% trans %} blocks: 12
  Twig alt attributes: 8
  Twig title attributes: 15
  Field labels: 245
  Field descriptions: 35
  Field placeholders: 4
  Field group labels: 24
  Field storage allowed values: 90

Twig Filter:
  - "Skip to main content" [html.html.twig]
  - "Filters" [form--views-exposed-form.html.twig]
  - "Pagination" [views-show-more-pager.html.twig]
...

Go to the Translation UI (/admin/config/regional/translate).

Cache Management

  • Cache ID: transparse:strings
  • Tags: ['transparse']
  • Backend: Default cache backend
  • Invalidation: Automatic on --force or manual via transparse:clear-cache

Troubleshooting

Strings not appearing in the Translation UI

  1. Run scan with force flag: drush transparse:scan --force
  2. Clear all caches: drush cr
  3. Check that locale module is enabled: drush en locale

Module not finding strings

  1. Verify path is correct: drush transparse:scan --path=web/themes/custom/mytheme
  2. Check file permissions on theme directory
  3. Run with verbose flag to see what's being found: drush transparse:scan --verbose

Performance issues

The module caches results. If scans are slow:

  1. Use the cache: Don't always use --force
  2. Scan specific directories when possible
  3. Results are cached permanently until cleared or forced

Extending the parser

To add new string extraction patterns, override the Service CLass TranslationParser.php. Add new regex patterns in the scanTwigFiles() or scanFieldConfigs() methods.

Credits

This module was developed with the help of Cline inside PHPStorm IDE.

Depends on

Dependencies of the latest stable release

  • locale Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
4
Tracked since
Oct 2025
Latest release
1 month ago
Releases (12 mo)
4 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
1.0.2 Stable 10–11 Jul 23, 2026
1.0.1 Stable 10–11 Nov 20, 2025
1.0.0 Stable 10–11 Oct 10, 2025
1.0.x-dev Dev 10–11 Oct 10, 2025