Skip to main content

Devbit

Translate tab missing on custom config form

You have created a custom Drupal configuration form but no Translate tab appears when you access it.
my_module.my_form_configuration_tab:
  route_name: my_module.my_form_configuration
  title: Configuration
  base_route: my_module.my_form_configuration

Issue:

You have created a custom Drupal configuration form but no Translate tab appears when you access it.

The config_translation module automatically derives the Translate tab from the configuration mapper. However, Drupal only renders the local task (tab) navigation when there are at least two tabs on the same level. Since the Translate tab is the only local task available, Drupal does not display the tab navigation, causing the Translate tab to remain hidden.

Prerequisites:

You have the config_translations module enabled.

Solution:

Drupal Core solves the issue for settings forms by providing a default tab. We apply the same approach in our module by adding a default local task, which allows Drupal to render the tab navigation and display the Translate tab.

Michael Ebert

Michael Ebert

Backend Developer / DevOps

Ihre Drupal-Website zukunftssicher machen

Wir prüfen Ihr System und zeigen, was Sie für AI, Wartung und Upgrades brauchen.