Problem/Motivation
At the moment there is two predefined language lists available to choose from:
- United Nations' official languages
- All languages
>
In our use case we only need 2 languages to be available in the list - English and Māori (which is not in the standard language list but this is separate issue).
Māori is not in the UN list so that doesn't fit.
We could use "All languages" as a work around (if Māori was there ) but UX if that is horrible.
Proposed resolution
Provide a way to create a custom, site specific, language list. "Language" CKEditor plugin configuration form could be changed to have third option - Custom, selecting which user will be presented with the multiselect list of all languages from which they can choose.
Remaining tasks
- agree on approach
- consider UX
- code
- review
- test
- commit
User interface changes
TBC
API changes
None
Data model changes
None
Release notes snippet
TBD
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | add_available_langs_as_ck_langs-3192734-17.patch | 2.9 KB | ifrik |
| #16 | add_available_langs_as_ck_langs-3192734-16.patch | 3.53 KB | ifrik |
| #9 | add_available_langs_as_ck_langs-3192734-9.patch | 2.87 KB | liquidcms |
Issue fork drupal-3192734
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:
- 3192734-allow-language-list
changes, plain diff MR !1665
Comments
Comment #6
jwaxo commentedBy complete coincidence I was working on this exact issue last Friday. While it does not solve your exact request, it does allow for customizing of the languages dropdown via the configurable Drupal languages list, with a new option in ckeditor to pull languages from the internal system. https://git.drupalcode.org/project/drupal/-/merge_requests/1665
Comment #7
marcvangendI agree, a configurable list is the only solution that makes sense.
In 14 years of Drupal development I have never had to build a site that supports exactly these 6 official UN languages. To even offer that option seems rather arbitrary. IMHO it should be removed, but at least it should not be the default.
At the risk of stretching the scope of this issue, I would propose offering 3 options:
- All enabled languages [default]
- All languages
- Selected languages
The third option should reveal an additional form element to select languages.
Comment #8
liquidcms commented@jwaxo, i am sure years until this would ever get merged, so would a patch file not be more useful here? Do you know if possible to create a patch file from gitlab MR? Of course i can manually make the edits and then create a patch.. :(
Comment #9
liquidcms commentedfound it.
Comment #10
liquidcms commentedTested the patch on 9.2.11 and works as expected. Thanks for this; hopefully gets merged to core.
Comment #11
marcvangendThanks for the patch. To get it in core, it needs tests.
Comment #12
eelkeblok@liquidcms Creating a patch from a a merge request is surprisingly easy. See https://www.drupal.org/docs/develop/git/using-git-to-contribute-to-drupa.... Do make sure you save the patch in your local project and not use the URL directly; you don't want any arbitrary pushes changing the actual patch applied to your project.
Comment #13
ifrikThe language button now includes a drop-down for "enabled languages".
If a custom language has been added to the site, then this also shows up in the list of enabled languages.
This would also be relevant for the CKEditor 5 module.
Comment #14
wim leersSibling CKEditor 5 issue: #3273986: Third option for the CKEditor 5 "Language" button: `site_configured` (in addition to `un` and `all`).
Either we should expand the scope of this issue to also do the work for CKEditor 5, or that issue needs to be postponed on this one, because this will require changes in the CKEditor 4 to 5 upgrade path.
Patch review
Patch looks great, just one nit:
Nit: no blank line before the
break;.Comment #15
wim leersComment #16
ifrikI've changed the wording for the third option and the description in the same way as in the related issue for CKEditor5 #3273986: Third option for the CKEditor 5 "Language" button: `site_configured` (in addition to `un` and `all`), fixed the coding standard errors, and updated the test.
Comment #18
ifrikI'm adding a new patch to just change the wording, but it still needs the test required in #11
Comment #20
quietone commentedCKEditor has been removed from core, CKEditor 4 is removed from Drupal Core in 10.0.0
Comment #21
xurizaemonThere's been progress on the CKEditor 5 issue at #3273986: Third option for the CKEditor 5 "Language" button: `site_configured` (in addition to `un` and `all`) and there may be improvements from that issue to introduce here to keep them in parallel.
In that issue, I felt that "enabled" was unclear (enabled how - per the input format settings, the site's configured languages, or some other method?), and substituted "enabled" for "site_configured" so that an option like the one suggested in #7 here and #3375157: [upstream] CKEditor 5 language selector cannot be scrolled if "All NNN languages" option selected could use another term like "format_plugin" and the values would be meaningful.