- Issue created by @miikamakarainen
- Assigned to sakthi_dev
- ๐ฎ๐ณIndia sakthi_dev
Created a patch for translating the title of media library dialog after enabling it for text format. Attached the screenshot as well. Please review.
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 7:09am 14 March 2023 - ๐ซ๐ฎFinland miikamakarainen
Tested patch in #3, the translation works now as intended.
I removed the title attribute for said dialog from ckeditor5.ckeditor5.yml as I believe that value is now not used at all, I also simplified the patch a bit.
- Status changed to Needs work
over 1 year ago 5:13pm 14 March 2023 - ๐บ๐ธUnited States smustgrave
Thank you for reporting the issue.
Next step will be to get a test assertion in place to check that it's properly translated.
- Status changed to Needs review
over 1 year ago 9:13am 20 March 2023 - ๐ซ๐ฎFinland miikamakarainen
I'm not too familiar with testing but should this test regarding if the translation works be done in the core media_library module instead?
In the core media_library module there is tests regarding if the library translation works as intended, the current translation test has call to waitForText('Add or select media') in both dutch and spanish, by updating them to the correct translated strings the test should fail if the strings are not translated.
Attached a patch regarding proposed change but this should perhaps be moved to a separate issue regarding the media_library module, not ckeditor5.
- Status changed to Needs work
over 1 year ago 1:27pm 20 March 2023 - ๐บ๐ธUnited States smustgrave
@ameymudras that's the test-only patch FYI that you're carrying forward.
@miikamakarainen if that's where you want to place them you should use the
t()
function. So we don't have to pull cspell ignroes in. - Status changed to Needs review
over 1 year ago 2:30pm 20 March 2023 - ๐ซ๐ฎFinland miikamakarainen
@smustgrave if I have understood things correct the test in media_library will fail when the dialog is patched so it needs updating either way as waitForText('Add or select media') will not be in english when the string is translated.
Attached an updated patch which checks if the ui dialog is translated correctly and waits for the element instead of the dialog title text.
- Status changed to Needs work
over 1 year ago 4:49pm 20 March 2023 - ๐บ๐ธUnited States smustgrave
Correct but when you use the t('Add or select media') it will check for the translated string. Or else we have to cspell ignore those specific lines as they are failing the custom commands.
- ๐ง๐ชBelgium borisson_ Mechelen, ๐ง๐ช
Correct but when you use the t('Add or select media') it will check for the translated string. Or else we have to cspell ignore those specific lines as they are failing the custom commands.
I disagree with using t in the tests themselves. See https://www.drupal.org/project/drupal/issues/2875148 โ for background info
- ๐บ๐ธUnited States smustgrave
But in this scenario we are testing translations
Hiding 14 as it removes the fix to the problem.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
I was going to say "but CKEditor 5 plugin labels are translatable and they're also defined in that YAML file, so why don't these work?"
The answer:
\Drupal\ckeditor5\Annotation\DrupalAspectsOfCKEditor5Plugin::$label
has:/** * The human-readable name of the CKEditor plugin. * * @var \Drupal\Core\Annotation\Translation * @ingroup plugin_translatable */ public $label;
Such annotations are not possible for each plugin's custom metadataโฆ
So +1 for this.
#13: I think @smustgrave is right in #15 โ see
\Drupal\Tests\ckeditor5\FunctionalJavascript\LanguageTest::test()
for example ๐-
+++ b/core/modules/media_library/tests/src/FunctionalJavascript/TranslationsTest.php @@ -151,7 +151,9 @@ public function testMediaLibraryTranslations() { + $this->assertSame('Media toevoegen of selecteren', $header_text);
Just add
// cSpell:disable-next-line
above this line.
-
+++ b/core/modules/media_library/tests/src/FunctionalJavascript/TranslationsTest.php @@ -164,7 +166,9 @@ public function testMediaLibraryTranslations() { + $this->assertSame('Aรฑadir o seleccionar medio', $header_text);
Same here.
โฆ then this will pass tests and I'll RTBC ๐
-
- Status changed to Needs review
over 1 year ago 4:43am 24 March 2023 The last submitted patch, 17: 3347212-17.patch, failed testing. View results โ
- Status changed to Needs work
over 1 year ago 6:51am 24 March 2023 - ๐ซ๐ฎFinland miikamakarainen
Updated the patch from #11 according to #16 (skipped #17 and #20 as they introduced a typo in the spellings).
I'm a bit worried that this patch wont pass the testing procedure somehow as the previous test results have failed and that is because the string has been in English in the testing environment. Attached screenshots from my local environment just to verify that the strings are correct and the translation part of the patch works.
If the tests fails with due to asserting the strings, could it be so that the testing environment does not have the dutch or spanish localization strings available? If so, then we cannot test that this string has been translated.
- ๐ซ๐ฎFinland miikamakarainen
Adding accidentally stripped space which corrupted the patch in #21.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
#23 will not apply because it was relative to
web/core
, notcore
.But you're right, even after enabling the
locale
module, the translation test is not working. In hindsight, I was wrong in #16 โ because\Drupal\Tests\ckeditor5\FunctionalJavascript\LanguageTest::test()
is testing CKEditor 5's UI translations, not Drupal's!So per #2875148: BrowserTestBase: Steer new test development away from translation โ , we AFAICT should simply not have any test coverage for this. Is that right, @borisson_?
- ๐ซ๐ฎFinland miikamakarainen
If we are not to test any translations then the patch in #5 should be ok and it has passed testing. We do not need to update the media_library tests as the ui elements (in the testing environment) are unaffected by this change.
- ๐ง๐ชBelgium borisson_ Mechelen, ๐ง๐ช
So per #2875148: BrowserTestBase: Steer new test development away from translation, we AFAICT should simply not have any test coverage for this. Is that right, @borisson_?
Yes, this was also discussed in slack, and catch agreed that there is no test coverage needed. So #5 should be correct patch here.
- Status changed to RTBC
over 1 year ago 9:32am 31 March 2023 - ๐ซ๐ฎFinland lauriii Finland
This should address the failing custom commands.
-
larowlan โ
committed f8c9f1fe on 10.0.x
Issue #3347212 by miikamakarainen, sakthi_dev, Yogesh Sahu, lauriii,...
-
larowlan โ
committed f8c9f1fe on 10.0.x
-
larowlan โ
committed 492594cb on 10.1.x
Issue #3347212 by miikamakarainen, sakthi_dev, Yogesh Sahu, lauriii,...
-
larowlan โ
committed 492594cb on 10.1.x
-
larowlan โ
committed ce1f04c8 on 9.5.x
Issue #3347212 by miikamakarainen, sakthi_dev, Yogesh Sahu, lauriii,...
-
larowlan โ
committed ce1f04c8 on 9.5.x
- Status changed to Fixed
over 1 year ago 7:04am 3 April 2023 - ๐ฆ๐บAustralia larowlan ๐ฆ๐บ๐.au GMT+10
Committed to 10.1.x. and backported to 10.0.x and 9.5.x
Thanks all
Automatically closed - issue fixed for 2 weeks with no activity.