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.

  1. United Nations' official languages
  2. "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

  1. Install Drupal and enable Content translation, Language and any required modules, along with CKEditor
  2. At /admin/config/regional/language, press "Add a language"
  3. Select "Custom language" and enter "mi" for language code and "Māori" for title
  4. At /admin/config/content/formats/manage/basic_html under "CKEditor 5 plugin settings - Source editing", add <span lang dir> to the allowed tags and press Save
  5. At /admin/config/content/formats/manage/basic_html under "Toolbar configuration", drag the "Language" button to the CKEditor toolbar
  6. At /admin/config/content/formats/manage/basic_html under "CKEditor 5 plugin settings - Language", the options are "United Nations official languages" and "All 107 languages". Choose "All 107 languages" (results are same regardless)
  7. Create some content using the configured input format, and note that the custom language configured in (3) above is not available
  8. 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

  1. agree on approach
  2. implement
  3. code
  4. review
  5. test
  6. 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

Command icon 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

xurizaemon created an issue. See original summary.

xurizaemon’s picture

Issue summary: View changes
xurizaemon’s picture

Issue summary: View changes
xurizaemon’s picture

Issue summary: View changes

xurizaemon’s picture

Title: CKEditor "Language » Add option to select from Drupal's enabled languages to CKEditor "Language" button
Status: Active » Needs review
xurizaemon’s picture

Issue summary: View changes
xurizaemon’s picture

Assigned: Unassigned » xurizaemon
Status: Needs review » Needs work

Self assigning while I get an initial MR into shape.

xurizaemon’s picture

Status: Needs work » Closed (duplicate)

Argh ... 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 :)

xurizaemon’s picture