Problem/Motivation
CKEditor's Language button permits a content editor to apply lang attribute to content sections.
While Drupal can be configured to use multiple languages, including custom languages, this CKEditor interface only permits picking one of two lists of languages, neither supporting custom languages.
- United Nations' official languages
- "All" languages (the label says "all", but it's not all languages, it's the predefined list from
LanguageManager::getStandardLanguageList()
In our use case we only need 2 languages for a bilingual site. We cannot use the UN list or the standard list as Māori does not appear in either. Even if all the desired languages do appear in the full list, the content editor UX would be improved for many sites by reducing the number of unused languages from the list to choose from.
This was previously raised against Drupal core in #3192734: Third option for the CKEditor 4 "Language" button: `enabled` (in addition to `un` and `all`) and moved to CKEditor 4 when that module went to contrib. It is also raised in #1993928-216: Language of parts: Introduce a language toolbar button.
Steps to reproduce
- Install Drupal and enable Content translation, Language and any required modules, along with CKEditor
- At
/admin/config/regional/language, press "Add a language" - Select "Custom language" and enter "mi" for language code and "Māori" for title
- At
/admin/config/content/formats/manage/basic_htmlunder "CKEditor 5 plugin settings - Source editing", add<span lang dir>to the allowed tags and press Save - At
/admin/config/content/formats/manage/basic_htmlunder "Toolbar configuration", drag the "Language" button to the CKEditor toolbar - At
/admin/config/content/formats/manage/basic_htmlunder "CKEditor 5 plugin settings - Language", the options are "United Nations official languages" and "All 107 languages". Choose "All 107 languages" (results are same regardless) - Create some content using the configured input format, and note that the custom language configured in (3) above is not available
- Note that even with two languages enabled for the site, the UX of finding a language in a list of 107 languages is poor
Proposed resolution
Add a third option to "Language" CKEditor plugin configuration form: Enabled, which presents the currently enabled languages for the site.
Remaining tasks
- agree on approach
- implement
- code
- review
- test
- commit
User interface changes
TBC
API changes
CKEditor 5 "Language" plugin will need access to the language manager service.
Data model changes
None
Release notes snippet
TBD
Issue fork drupal-3383582
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
xurizaemonComment #3
xurizaemonComment #4
xurizaemonComment #6
xurizaemonComment #7
xurizaemonComment #8
xurizaemonSelf assigning while I get an initial MR into shape.
Comment #9
xurizaemonArgh ... despite search attempts, I missed finding #3273986: Third option for the CKEditor 5 "Language" button: `site_configured` (in addition to `un` and `all`) until now. Closing duplicate, will join forces over there :)
Comment #10
xurizaemon