i have the following data row :
ID, Name (English), Name(French)
how can i import into Drupal 7 node using Migrate in proper way so that if i rollback it rollback from all language etc etc.
if its not the right forum for this request please guide me in that case.
Thanks in advance.
Comments
Comment #1
rob_johnston commentedI would make 2 migrations, one for English and one for French. I would also set the French to be dependent on the English and then write a postImport() function on the French that makes translation sets. If anybody follows another pattern then I'd love to hear of it.
Comment #2
mikeryanWhat would you like the result of the migration to be? If you want two nodes, an English node and a French node related in a translation set, then @rob_johnston's approach would be correct. If instead you want one node where the name field has an English value and a French value, it's a little trickier - you need to do some manipulation in prepareRow(), like:
I haven't done multilingual migration like this myself, so let me know if that doesn't work.
Comment #3
mikeryanComment #4
rob_johnston commentedWell as a last word, I can confirm that works, but you'll need something like this too:
Comment #5
digitaldonkey commented@mikeryanIs this the way it should work in D8 too?
Comment #6
digitaldonkey commentedIn Drupal 8 it seems the multilingual import is not really working yet as designed.
I ended up implementing the MigrateEvents::POST_ROW_SAVE Event.
Maybe someone will find a way to multilingual migrations using the following:
donkeymedia_migrate/donkeymedia_migrate.services.yml
donkeymedia_migrate/src/EventSubscriber/DonkeymediaMigratePostSave.php
I know this is the kind of the wrong place to publish this, but repeatedly ended up here searching for solutions.
Comment #7
digitaldonkey commentedComment #8
star-szrComment #9
mpp commented@digitaldonkey have you found a better way of doing it for Drupal 8?
edit: This is how core handles multilingual migrations for Drupal 8: https://www.drupal.org/node/2225775
Comment #10
caspervoogt commented@digitaldonkey what version of Drupal core did your code work with? I tried it on 8.1.7-dev and it caused some fatal errors, so then I tried with 8.0.0 and 8.0.1 and also no luck.