From 561b075a252619521888dcd120f1c21716b41913 Mon Sep 17 00:00:00 2001 From: i-just Date: Thu, 12 Mar 2026 14:54:18 +0100 Subject: [PATCH 1/3] cke compliant language codes --- src/Field.php | 3 +- src/web/assets/BaseCkeditorPackageAsset.php | 107 ++++++++++++++++++++ 2 files changed, 109 insertions(+), 1 deletion(-) diff --git a/src/Field.php b/src/Field.php index a059ed52..c94c40b7 100644 --- a/src/Field.php +++ b/src/Field.php @@ -1432,7 +1432,8 @@ private function _inputHtml(mixed $value, ?ElementInterface $element, bool $stat // Add the translation import $uiLanguage = BaseCkeditorPackageAsset::uiLanguage(); - $uiTranslationImport = "import coreTranslations from 'ckeditor5/translations/$uiLanguage.js';"; + $importCompliantUiLanguage = BaseCkeditorPackageAsset::getImportCompliantLanguage(BaseCkeditorPackageAsset::uiLanguage()); + $uiTranslationImport = "import coreTranslations from 'ckeditor5/translations/$importCompliantUiLanguage.js';"; $view->registerScriptWithVars(fn($baseConfigJs, $toolbarJs, $languageJs, $showWordCountJs, $wordLimitJs, $characterLimitJs, $imageMode) => << Date: Thu, 12 Mar 2026 09:29:34 -0700 Subject: [PATCH 2/3] `@since` --- src/web/assets/BaseCkeditorPackageAsset.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/web/assets/BaseCkeditorPackageAsset.php b/src/web/assets/BaseCkeditorPackageAsset.php index 32f8c0aa..a8c46b46 100644 --- a/src/web/assets/BaseCkeditorPackageAsset.php +++ b/src/web/assets/BaseCkeditorPackageAsset.php @@ -110,6 +110,7 @@ abstract class BaseCkeditorPackageAsset extends AssetBundle * * @param string $language * @return string + * @since 5.2.0 */ public static function getImportCompliantLanguage(string $language): string { From 5ebefb8476d95fe2bb34c7659b6f1f68eed7d4ec Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Thu, 12 Mar 2026 09:29:45 -0700 Subject: [PATCH 3/3] Release notes [ci skip] --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d6c757f..96ce238c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,11 @@ ## Unreleased +- Added `craft\ckeditor\web\assets\BaseCkeditorPackageAsset::getImportCompliantLanguage()`. - Fixed a bug where custom `toolbar` config settings were getting ignored. ([#522](https://github.com/craftcms/ckeditor/issues/522)) - Fixed a bug where files uploaded to Assets fields could also be added to nearby CKEditor fields. ([#523](https://github.com/craftcms/ckeditor/issues/523)) - Fixed an error that could occur when registering a custom CKEditor plugin. ([#525](https://github.com/craftcms/ckeditor/issues/525)) +- Fixed a JavaScript error that occurred if the control panel was being translated into a language that CKEditor doesn’t support. ([#526](https://github.com/craftcms/ckeditor/issues/526)) ## 5.1.0 - 2026-03-05