Problem/Motivation
Sites that run `language_switcher_dialog_countries` alongside the `disable_language`
contrib module currently have no integration between the two: the `grouped_by_region`
provider renders links for all languages regardless of the `'view disabled languages'`
permission, and the render cache does not vary by `user.permissions`.
Steps to reproduce
1. Install `language_switcher_dialog_countries` and `disable_language`.
2. Create at least two site languages, e.g. English and French.
3. Disable French via `/admin/config/regional/language` using the
`disable_language` controls.
4. Enable the new `language_switcher_dialog_disable_language` integration submodule.
5. As an anonymous user (or a user **without** "view disabled languages"),
open the language switcher dialog.
6. **Desired**: French is hidden from the dialog.
7. As a user **with** "view disabled languages", open the dialog.
8. **Desired**: French appears in the dialog.
Proposed resolution
Rather than modifying `RegionGroupedProvider` directly (which would force
`disable_language` awareness on every site), the integration is packaged as a
new companion submodule:
```
modules/language_switcher_dialog_disable_language/
├── language_switcher_dialog_disable_language.info.yml
├── language_switcher_dialog_disable_language.module
└── src/
└── Plugin/
└── DialogContentProvider/
└── DisableLanguageRegionGroupedProvider.php
```
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | admin.PNG | 84.38 KB | angel_devoeted |
| #4 | user.PNG | 91.42 KB | angel_devoeted |
Issue fork language_switcher_dialog-3608953
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 #3
aren33k commentedComment #4
angel_devoeted commentedReviewed the
MR !3and tested onDrupal 11.x.xvia DrupalForgeCode looks solid.
Confirmed that disabled languages are correctly hidden for anonymous users and visible for admins.
Works as expected.
Admin view:

Anonymous User view:

Comment #6
svendecabooterThanks for the MR and extra functionality.
See my MR comment above.
Can you retest if the generic hook approach still works for you? Hopefully that would be a good extension point where other modules can also plug into, if needed.
Comment #7
angel_devoeted commentedThanks for the clean refactor, @svendecabooter!
Retested the updated
MR !3.The new alter hook implementation works as expected.
Disabled languages are properly hidden for anonymous users and remain visible for administrators.
Comment #8
svendecabooterComment #11
svendecabooter