Skip to content

cke compliant language codes#530

Merged
brandonkelly merged 4 commits into5.xfrom
bugfix/526-cke-and-supported-languages
Mar 12, 2026
Merged

cke compliant language codes#530
brandonkelly merged 4 commits into5.xfrom
bugfix/526-cke-and-supported-languages

Conversation

@i-just
Copy link
Contributor

@i-just i-just commented Mar 12, 2026

Description

CKEditor doesn’t support all the languages that Craft does. It also often only supports the major version, not localised ones (e.g., it supports fr but not fr-FR, fr-CA, fr-BE, etc.; doesn’t support Welsh or Icelandic, etc.).

Since we’re now using imports to get the correct translation files, we need to check whether the file exists before importing it, or the field won’t render.

In order to mitigate this issue, I created a list of translation files (language codes) that ship with CKEditor and a method that will “translate” Craft’s language code to CKEditor’s. We use this language code when creating the ui translation import statement.

@brianjhanson, if you have a better idea for handling this without maintaining a list of supported languages, please let me know!

Steps to reproduce:

  1. clean 5.9.x installation with CKEditor 5.1.0
  2. create a user that doesn’t have a language preference set via the control panel (in the "language" set to null in the userpreferences table)
  3. create a CKEditor field (all the default settings are fine)
  4. create a section with an entry type that has the above field (all default settings)
  5. create an entry in that section - the field will render as expected
  6. in the config/general.php set the defaultCpLanguage to nl-NL or de-DE or en-CA or is or cy
  7. refresh the entry from step 5 - the field won’t render, and you should see an error in the console

Related issues

#526

@i-just i-just requested a review from brandonkelly as a code owner March 12, 2026 14:00
@brandonkelly brandonkelly merged commit 0be0b10 into 5.x Mar 12, 2026
2 checks passed
@brandonkelly brandonkelly deleted the bugfix/526-cke-and-supported-languages branch March 12, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants