Problem/Motivation
On Configuration → Regional and language → Content language and translation (`/admin/config/regional/content-language`), each bundle is listed using only its human-readable label (`$bundle_info['label']`), not its machine name. Bundle labels are not required to be unique.
When two or more bundles of the same entity type share the same label, they appear as duplicate rows in the table and administrators cannot tell which bundle they are configuring. This affects any bundleable content entity (nodes, paragraphs, media, etc.), not only Paragraphs.
Example:
- Paragraph type `text` — label: "Text"
- Paragraph type `sidebar_text` — label: "Text"
Both appear as "Text" in the Paragraph row. Changing `sidebar_text`’s label to "Sidebar text" makes it visible again, which confirms the bundles are present but indistinguishable by label alone.
Steps to reproduce
1. Ensure the Language module and Content translation are enabled.
2. Create two bundles of the same entity type with the same label, e.g.:
- Paragraph type `text` — label "Text"
- Paragraph type `sidebar_text` — label "Text"
3. Go to `/admin/config/regional/content-language`.
4. Enable custom language settings for Paragraph (if not already).
5. Open the Paragraph details section.
Expected: Each bundle is listed and clearly identifiable (e.g. label + machine name, or unique display per row).
Actual: Only one paragraph labeled 'text' is visible/listed.
Proposed resolution
When multiple bundles of the same entity type share the same label string, append the bundle machine name for display only, e.g.:
- `Text (text)`
- `Text (sidebar_text)`
Unique labels should remain unchanged. Form structure and configuration export must continue to use bundle machine names only.
User interface changes
Duplicate bundle labels on the content language settings form show the machine name in parentheses.
Issue fork drupal-3593441
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
marcin dębicki commentedComment #3
marcin dębicki commentedComment #6
skifdesu commentedAdded MR which solves the issue.
Comment #7
smustgrave commentedInstead of a new test can we expand an existing one
Comment #8
skifdesu commented> Instead of a new test can we expand an existing one
Moved the test to the existing LanguageSelectorTranslatableTest.php test.
Comment #9
smustgrave commentedThis is a perfect example of a test that can be a kernel now thanks to https://www.drupal.org/node/3502609
Comment #10
skifdesu commentedConverted the test to a kernel test using HttpKernelUiHelperTrait as suggested in #16.
Comment #11
amitgoyal commentedReviewed the fix and tested locally.
The fix uses array_count_values() to detect when multiple bundles share the same label, and disambiguates them by appending the machine name in the format "Label (machine_name)". Bundles with unique labels are unaffected.
Test coverage: a new kernel test ContentLanguageSettingsFormTest using HttpKernelUiHelperTrait creates two content types both named "Text" (machine names text and sidebar_text) plus a unique "Unique" type, then asserts:
- "Text (text)" and "Text (sidebar_text)" appear in the form
- "Unique" appears as-is (no machine name appended)
Local results: 1 test, 17 assertions — all pass. Browser validation on DDEV confirmed "Text (text)" and "Text (sidebar_text)" both appear correctly on /admin/config/regional/content-language.
LGTM.
Comment #12
quietone commentedChanges to the UI should have before and after images available from the issue summary.
Comment #13
godotislateNW for #12.