Problem/Motivation
Bundle labels in the "Add new" dropdown were not being translated. The getBundleInfo() method returns plain string labels that bypass Drupal's translation system, resulting in UI text appearing only in the site's default language regardless of the current language context.
Steps to reproduce
1. Install a Drupal site with multiple languages enabled
2. Create a content type with config translation for the label, @see https://camoa.github.io/dev-guides/drupal/multilingual/config-translation/
3. Add an Inline Entity Form Complex on the type from 2.
4. Switch to a non-default language whilst using the form from 3.
5. Observe: Bundle labels in the "Add new" dropdown remain untranslated (shown in default language)
Proposed resolution
Wrap $bundle_info['label'] with $this->t() to make bundle labels translatable:
$bundles[$bundle_name] = $this->t((string) $bundle_info['label']);
This ensures bundle labels are processed through Drupal's translation system, making them language-aware.
Remaining tasks
None. This is a complete fix.
User interface changes
Bundle labels in the "Add new" entity dropdown will now display in the current site language instead of always showing the default language.
API changes
None.
Data model changes
None.
Issue fork inline_entity_form-3608068
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
tomsaw commentedComment #4
tomsaw commented