Problem/Motivation
Soon we have multilingual support.
#2414913: Support entity translation of paragraphs
This is an important aspect in the application of paragraphs.
Proposed resolution
Properly configure demo paragraphs / fields to be translatable.
(We also need multiple languages setup.)
Still if this is not needed for a simple demo, just ignore the "Translate" tab and the language selector when creating/editing content.
Alternatively we could have a separate multilingual content type setup to avoid multilingual confusion if it is completely irrelevant for audience.
Remaining tasks
User interface changes
API changes
| Comment | File | Size | Author |
|---|---|---|---|
| #55 | demo_module-2461689-55-interdiff.txt | 608 bytes | sasanikolic |
| #55 | demo_module-2461689-55.patch | 22.24 KB | sasanikolic |
| #53 | demo_module-2461689-53-interdiff.txt | 3.77 KB | sasanikolic |
| #53 | demo_module-2461689-53.patch | 22.26 KB | sasanikolic |
| #49 | demo_module-2461689-49-interdiff.txt | 2.08 KB | sasanikolic |
Comments
Comment #1
miro_dietikerComment #2
miro_dietikerComment #3
miro_dietiker(Jeroen: I think we should have a demo component in the issue queue.)
Comment #4
jeroen.b commentedI added the Demo component.
Comment #5
miro_dietikerNice, moving to demo component.
I'm promoting this to major since i want to use Paragraphs as a reference example for smooth multilingual workflows combined with TMGMT.
In the best case, this means, the demo contains the multilingual setup.
Comment #6
sasanikolic commentedExtended the demo module for multilingual support.
Comment #8
sasanikolic commentedFixed the failing test.
Comment #9
sasanikolic commentedFIxed a schema config.
Comment #10
sasanikolic commentedChanged the test and added the config files.
Comment #14
sasanikolic commentedFixed the test fails - some configuration for translating text+image were missing.
Comment #15
mbovan commentedI think the UUID should be removed.
Is there any other way to add French translation (e.g. clicking a button somewhere?) in tests, except visting
/fr/node/1/translations/add/en/frdirectly?Comment #16
sasanikolic commentedThanks.
1.) Done.
2.) I think hardcoding the link is fine. clickLink('Add') doesn't work now because it clicks on the first Add button that it finds. But now, after loading the languages from the configs we have them in different order...
Comment #17
LKS90 commentedI'm adding a test for the demo module now.
Considering 2.) in #16: clickLink also has an optional second parameter which is the index of the button to click. Messy but it works. I'll upload a working patch tomorrow hopefully. My test for the demo module still has a schema error
Comment #18
LKS90 commentedHere is the test I was talking about up there, just so Saša might continue working on it.
Comment #20
LKS90 commentedAn updated version. It's supposed to pass the tests but I'm having some problems locally (last drupalPostForm returns a 500 error message).
Comment #21
sasanikolic commentedComment #23
sasanikolic commentedRe-made the test from scratch and added the checks for the default configurations.
Comment #24
sasanikolic commentedExtended the test with paragraphs creation.
Comment #30
miro_dietikerPHP Fatal error: Class 'Drupal\search_api\Tests\WebTestBase' not found in /var/lib/drupaltestbot/sites/default/files/checkout/sites/default/modules/paragraphs/modules/paragraphs_demo/src/Tests/ParagraphsDemoTest.php on line 15
With only resolved dependencies to entity_reference_revisions (and paragraphs).
That's the problem.
Comment #31
LKS90 commentedCorrected the usage. The other Paragraphs tests use the simpletest WebTestBase, the demo test now does as well.
Comment #32
miro_dietikerLooks pretty nice.
description: Demo module for paragraphs.The paragraph demo module description needs to be extended. Also notify that it is a multilingual demo and adds german and french languages. And it should also state that it adds paragraph types, CSS (responsive wrapping) and... Not too much detail, but clear enough about contents.
Comment #33
LKS90 commentedI tried it with multiline description, but it doesn't really work. Feedback welcome (keep it like it is? Put it on one line?). I also changed the package (capitalisation) so all paragraphs modules are grouped together (there were 2 groups before).
Comment #34
LKS90 commentedAnd an interdiff of which shows the changes.
Comment #35
LKS90 commentedhttps://www.drupal.org/node/2506497 already changed the paragraphs group, rebase necessary.
Comment #36
LKS90 commentedRebased and reviewed, ready for commit if reviewed by someone else.
Comment #37
arla commentedWhen I save a node (new or existing), I get:
Sometimes when I visit the content overview, I get this PHP notice:
This (paragraphs + paragraphs_demo) doesn't depend on any other contrib module than entity_reference_revisions, right?
To make line breaks matter in YAML strings, you should use
|, not>. But it doesn't really matter, because the module description is just printed in the HTML and line breaks are ignored anyway. IMHO that's okay, the line break is not really necessary here.Should be protected.
Test method needs doc.
I get
when applying.
Comment #38
LKS90 commentedThe feedback has been implemented! Now we might want to add a demo node with paragraphs and translate that, the paragraphs_demo.install has plenty of space to do things.
Comment #39
LKS90 commentedComment #41
LKS90 commentedUpdated the test, assertOptionSelected didn't have a result for it's xpath call, doing it manually with an assertRaw for the HTML now.
Comment #42
LKS90 commentedComment #43
arla commentedThe assertOptionSelected calls must be failing because of #1305882: drupal_html_id() considered harmful; remove ajax_html_ids to use GET (not POST) AJAX requests (Core).
But assertRaw seems like an okay fix.
Comment #44
sasanikolic commentedAdded the introduction on the frontpage.
Comment #46
LKS90 commentedConcerning #41: #2530092: AssertOptionSelected() does not work for dynamic HTML IDs
The easiest solution right now:
#2530044: Edit widget test is failing
Revert the
assertRaw(), add the fixedassertOptionSelected()function temporarily.Comment #47
sasanikolic commentedFixed the test fails. Because of the new welcome node in the demo, the index of the node in the test has to be changed to 2.
Comment #48
LKS90 commentedThose should be reverted. Add the fixed
assertOptionSelected()method instead.Comment #49
sasanikolic commentedOk, reverted back to use
assertOptionSelected.Comment #50
berdirCool stuff!
Usually the group is the module machine name.
do the other tests also use Paragraphs? Then fine...
paragraphs_demo should depend on node.module, not the test.
Can we also add an assertion that the paragraphs reference field is *not* checked?
This probably makes the test almost twice as slow. I'd combine those two methods together.
applyUpdates() is now called in paragraphs_demo_install(), this shouldn't be needed anymore.
No leading /.
Comment #53
sasanikolic commentedFixes for the comments above.
Comment #54
LKS90 commentedChanging from
clickLinktodrupalGetis a bit much I'd say, just change it to$this->clickLink(t('Add'), 1);to click the second Add link on the page. Now we do the same thing as before and actually use the UI buttons instead of clicking links and then suddenly drupalGetting to the place we want to go to.Comment #55
sasanikolic commentedThanks, totally forgot about this easy way. :)
Comment #56
LKS90 commentedNow it's perfect! ;)
Comment #57
berdirYes, looks good to me as well.
Comment #59
jeroen.b commentedThanks guys, commited to dev, really appreciate all your hard work!