Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Sibling of #3228464: API for contrib projects to load CKEditor translations.
See https://git.drupalcode.org/project/ckeditor5/-/merge_requests/56#note_39145.
This will need tests similar to \Drupal\Tests\ckeditor\Kernel\CKEditorTest::testJSTranslation()
for CKEditor 4 in core.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork drupal-3228778
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
Wim LeersComment #3
Wim LeersDevil's advocate: should we really do this?
The strongest reason to do this is to make it simpler to provide translations for the strings in the Drupal-specific CKEditor 5 plugins that are in
core/modules/ckeditor5/js
.Comment #5
nod_Comment #6
nod_All right so at least, Using
Drupal.t
inside plugin code works. It is kept as-is after the build step and Drupal correctly picks up the string in the minified file (with and without a context defined).So for me I don't think we have anything more to do than make use of Drupal.t inside plugins and adding the dependency to
core/drupal
in the drupal library that defines the ckeditor5 plugin assets.Comment #8
Wim LeersThat sounds good!
The changes in the merge request look great — zero remarks 🤓
The only thing that remains here: test coverage, similar to CKE4's
\Drupal\Tests\ckeditor\Kernel\CKEditorTest::testJSTranslation()
.Comment #9
nod_Comment #10
Wim LeersComment #11
nod_Thanks for the text suggestions, always having trouble with that :)
Comment #12
Wim LeersYeah I wish that were just part of
phpcs
… some day!No more remarks here.
Comment #13
lauriiiWe need a Drupal 10 version of the MR too 😇
Comment #15
nod_10.x MR opened
Comment #16
Wim LeersThe two MRs are making identical functional changes, the only differences are in the compiled JS.
Comment #21
lauriiiCommitted cf6f4be and pushed to 10.0.x. Also committed the 9.x patch to 9.4.x and cherry-picked to 9.3.x because this only impacts CKEditor 5 which is experimental, and this makes some strings translatable that previously weren't which is nice improvement. Thanks!