Problem/Motivation
Toolbar button tooltipps are not translated if different language then English is enabled
Steps to reproduce
- Install Drupal in Englisch via Simplytest.me
- Enable Interface Translation Local and CKEditor 5
- Enable Ckeditor 5 in any text format e.g basic HTML
- Insert text part select to the CKEditor toolbar
- Add desired interface language e.g Geman
- Set the enabled Language to default
- Change Language Display order so that English is below the new enabled language
- Click on Manage>> Content >>Add Content >> Article
- Hover the mouse cursor over any button
Expected result: Tooltips should be displayed in Drupal's default UI Language
Current Result: Tooltips are still displayed in English.
Demo https://www.youtube.com/watch?v=XS-INmiEA8M
Proposed resolution
Find cause
Remaining tasks
find cause
fix
retest
release
User interface changes
Maybe translations on l.d.o are needed
API changes
maybe some
Data model changes
probably none
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #29 | 3250191-25-d9.patch | 5.75 KB | lauriii |
| #25 | core-ckeditor5-textpart-3250191-25.patch | 5.4 KB | nod_ |
| #25 | core-ckeditor5-textpart-3250191-25-FAIL.patch | 2.91 KB | nod_ |
| #23 | core-ckeditor5-textpart-3250191-23.patch | 5.29 KB | nod_ |
| #18 | core-ckeditor5-textpart-3250191-18.patch | 4.95 KB | nod_ |
Comments
Comment #2
joachim namysloComment #3
rkollernot only the tooltips. also the microcopy of the button labels isn't localized - see heading and language. same for the ie11 warning message on top and the title of the source editing vertical tab. i've tested with 9.3.0-beta2

Comment #4
rkollerok things might be a bit more tricky. i've additionally added another language (french) and the parts not translated differ to german - there is no consistent pattern of parts not translated across languages. not sure if it is due to a differing degree of translated strings or another reason? :/
the title of vertical headings tab isnt translated nor its content, same for source editing. but in contrast the language tab and its content is translated completely.
Comment #5
wim leers@rkoller These are all Drupal-owned UI strings, because you're in the CKEditor 5 toolbar configuration UI, which is Drupal-owned. If the translation for a string is not available in Drupal, then it won't be translated.
Still, we should still add test coverage for the admin UI too, to prove that it works if there are translated strings available.
Is the actual CKEditor 5 UX translated?Thanks to @Joachim Namyslo's YouTube video, I can see that this is broken! Even despite the test coverage in\Drupal\Tests\ckeditor5\FunctionalJavascript\LanguageTest::test()that tests this explicitly, this definitely does not work for you!@Joachim Namyslo: what langcode is your browser sending? Maybe CKEditor 5 is not interpreting yours correctly. That'd be required for us to reproduce this.
Let's test German explicitly to see if something is up with that…
Comment #6
joachim namysloI found out, that it actually was sending de-LI instead of de-DE. Currently, I changed that and spawn up a new simpllytest.me instance to check if that's the cause of this issue. I'll update this one, asap.
Update
Changed the lang code to de-DE as you can see from the Screenshot as follows, but there's even no change. Tooltips still remaining English
By the way, I am not sure if lang code sent by the browser is the right option here. Because as you can see if in general there is a multilingual installation and we switch language to another Japanese, for example, the lang code sends by the browser is still the same.
See the example screenshot as follows:
I checked langcode also via: http://www.reliply.org/tools/requestheaders.php
Result
Comment #8
wim leersI wonder … if https://github.com/ckeditor/ckeditor5/issues/8510 actually fixed this. It seems very closely related.
When we update to https://github.com/ckeditor/ckeditor5/releases/tag/v31.1.0, we'll find out 🤓
(I'll only get to this in January — but you could already create a merge request or patch to get us on that version, and that'd allow you to test this ahead of time 🤞:D)
Comment #9
wim leersPer #8.
Comment #10
wim leers#3258250: Update to CKEditor5 v31.1.0 landed!
@Joachim Namyslo: could you please test this again with the latest development snapshot of Drupal core 9.3, 9.4 or 10.0 (any of those is fine!) 🙏
Comment #11
joachim namysloTested it on 10 and 9.4.0-dev As you can see from the video linked down below, that issue is still valid.
https://youtu.be/LvdjxXAhuP0
I forgot to check the console in th video so here is the output i got when ckeditor 5 was enabled
Comment #12
wim leersThanks for checking! 🙏 We'll investigate.
My initial hunch: this only happens when changing the default language, i.e. when there is not a translation requested through language negotiation.Nope, that can't be it, because\Drupal\Tests\ckeditor5\FunctionalJavascript\LanguageTest::test()is testing exactly that! 😬P.S.: next time just test on a single branch — they're all kept in sync functionality-wise 🤓
P.P.S.: the console log entries are for CKEditor 4, not for CKEditor 5, so should not explain this. But who knows 🤪
Comment #13
lauriiiI was able to reproduce this when text part language plugin is enabled. Based on #11, it seems like text part language was also enabled on the environment where the issue was reported from.
Comment #14
lauriiiThe root cause of the problem is that the text part language and UI translation both use the language key for their configuration. This is not something we take into account in
Drupal.editors.ckeditor5.attach(), meaning that the configuration coming from text part language is overriding the previously set language configuration which is configuring the language CKEditor should be using.Comment #15
wim leersWow, thanks for the digging, @lauriii!
Comment #16
lauriiiComment #17
nod_Comment #18
nod_Comment #19
wim leersWhy not add this to
\Drupal\Tests\ckeditor5\FunctionalJavascript\LanguageTest?Comment #20
nod_Mainly I didn't want to find how to add a second test method when there is a data provider and I wanted to test only the conflict, not the translation feature at the same time.
Comment #21
wim leersIt's just
@dataProvider METHODNAME:)The test methods run separately, so there is no risk of that. Or if you meant you didn't want the tests to run in parallel … well, sadly,
FunctionalJavascripttests do not support that all, so no risk there :P…
Upon further inspection …
… the test method is identical to what we already have in
\Drupal\Tests\ckeditor5\FunctionalJavascript\LanguageTest::test(), only the second parameter has a different name! So … then we should just add a new case to the existing data provider? Or am I missing something? 🤔Comment #22
nod_not identical, check the button that is clicked. It's
textPartLanguage, notblockQuote:), will reroll.Comment #23
nod_extended the test data a bit, better, thanks :)
Comment #24
wim leers#22 Gah missed that — makes sense!
Let's rename
$pluginto$toolbar_item_name— because a single plugin can provide multiple toolbar items, and these are definitely toolbar items.Comment #25
nod_Here you go
Comment #26
wim leersRTBC assuming one red and one green patch in #25 — sadly no tests have run in the past 2 hours due to
10.0.xHEAD currently not passingComment #28
wim leersComment #29
lauriiiComment #33
lauriiiCommitted 414c7a4 and pushed to 10.0.x. Also committed patch from #29 to 9.4.x and cherry-picked to 9.3.x. Thanks!