Follow-up to #2225775: Migrate Drupal 6 core node translation to Drupal 8

Problem/Motivation

Drupal 6 with the i18n contributed module supports "synchronized fields", that will be kept the same amongst an entire translation set.

Proposed resolution

Turn "synchronized fields" into untranslated fields in the D8 content translation settings.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vasi created an issue. See original summary.

mikeryan’s picture

Status: Postponed » Active
Gábor Hojtsy’s picture

Issue summary: View changes

Updated issue summary noting that this is a Drupal 6 contrib feature, not a core feature.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

maxocub’s picture

Assigned: Unassigned » maxocub
maxocub’s picture

Assigned: maxocub » Unassigned
mikeryan’s picture

Priority: Major » Normal

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

quietone’s picture

Status: Active » Needs work

This enables i18nsync in the fixture and has a source plugin and test to get the i18nsync% variables from the variable table. Still to do is a process and destination.

But I've not used synchronized fields and am not sure what is supposed to happen. The IS states to "Turn "synchronized fields" into untranslated fields in the D8 content translation settings" which seems straight forward but what if the synchronized field has translations then why would the content translation setting be set to untranslated?

quietone’s picture

FileSize
236.57 KB

Meant to add the patch. I don't know why but adding the synchronized fields added a lot of data to the fixture.

masipila’s picture

Re-parenting so that all multilingual migrations can be found from the same meta. Moved original parent to related issues.

quietone’s picture

Woohoo! At Drupal South @thomas.feichter showed and explained to me how synchronized fields work!

heddn’s picture

Issue tags: +Migrate critical

Triaging the issue queue.

quietone’s picture

Status: Needs work » Needs review
FileSize
147.91 KB

Started using the Drupal 6 database created at Drupal South. It has once synchronized field, an email field, on the Company content type. I then added a text field to the same Content type and set it to synchronized. Then I looked into synchronized fields in Drupal 8 and came up with nothing. I see no setting nor did I find any docs or blogs etc.

So it seems that the value of a D6 synchronized field needs to be migrated to all the translations of the node. But what is the migration doing now, this issue was opened a long time ago and much has changed. To start I looked at the data for Company fields in the D6 db.

mysql> select * from content_type_company;
+------+-----+--------------------+-------------------------------------+
| vid  | nid | field_test2_email  | field_data_value                    |
+------+-----+--------------------+-------------------------------------+
| 2004 |  23 | french@example.com | Join us and work four days per week |
| 2005 |  24 | french@example.com | Join us and work four days per week |
+------+-----+--------------------+-------------------------------------+
2 rows in set (0.00 sec)

Ah, the field values are already duplicated for each field. This is likely to work correctly now without a new migration.

Just tested that by running a full migration using the UI and navigated to the Company nodes and the value for both synchronized fields is shown correctly on both nodes, the English and the French. Nice!

What next?

First, this needs to be tested by someone else to confirm the restuls. And if this is working for CCK fields then close this issue. I've uploaded the database used for testing this.

Second, do we know if this is working for other, non CCK, synchronized fields? In D6, on the Company content type, the following can be marked synchronized.

 Author
Status
Promote
Moderate
Sticky
Revision (Create also new revision for translations)
Book outline (with the translated parent)
Taxonomy terms
Comment settings
File attachments 
mikelutz’s picture

Title: D6 synchronized fields aren't migrated properly » D6 synchronized field settings aren't migrated properly

I'm looking into this a little more, but I believe this issue is more about the field settings not coming over properly than the content. The field should be marked as untranslatable, but the content does appear in the database correctly.

mikelutz’s picture

I believe this would be the test that needs to pass (though it should probably be moved into content_translation, now that I look at it)

Status: Needs review » Needs work
mikelutz’s picture

quietone’s picture

Status: Needs work » Needs review
FileSize
35.69 KB
116.4 KB

Just some cleanup on the patch. Setting to NR to make sure new errors are not introduced.
This will need a migration to change the translation setting of the synchronized fields.

Status: Needs review » Needs work

The last submitted patch, 22: 2754493-22.patch, failed testing. View results

quietone’s picture

Issue tags: +Needs reroll

The D6 fixture has changed so this most likely needs a reroll.

vacho’s picture

Patch rerolled

quietone’s picture

Status: Needs work » Needs review
FileSize
36.73 KB
5.73 KB

The field instance migration is changed to include the translatable field and the source plugin determines the value in prepareRow(), it is set true unless this is a synchronized field.

The test file that mikelutz created has been removed and the assertion moved to MigrateNodeTest because MigrateNodeTest already does lots of assertions on the migrated fields. Tests have been added to MigrateFieldInstance as well.

Status: Needs review » Needs work

The last submitted patch, 26: 2754493-26.patch, failed testing. View results

quietone’s picture

Assigned: Unassigned » quietone
Status: Needs work » Needs review

I've got some fixes locally for this, just need some time to get it ready.

quietone’s picture

Status: Needs review » Needs work

Hmm, that should be NW

quietone’s picture

Status: Needs work » Needs review
FileSize
38.14 KB
57.53 KB

This add i18nsync to the list of noUpgradePaths since it provides functionality, the source_module has not changed. Also the node type the sync field is on has been changed from company to employee because using company conflicted with the test MigrateLanguageContentSettingsTest.

Status: Needs review » Needs work

The last submitted patch, 30: 2754493-30.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
FileSize
39.13 KB
849 bytes

Forgot the entity counts

Status: Needs review » Needs work

The last submitted patch, 32: 2754493-32.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
FileSize
39.48 KB
628 bytes

Adjust the the other entity counters for the new field.

quietone’s picture

Status: Needs review » Needs work

Last thing is to check the changes to the fixture. Can anymore be removed?

quietone’s picture

Status: Needs work » Needs review

Double checked the changes to the fixture and I'm just not sure if all the changes to locales_source are needed. I know they are not needed for the tests but maybe they are needed when working via a Drupal 6 UI.

Ready for review.

quietone’s picture

Assigned: quietone » Unassigned
mikelutz’s picture

Status: Needs review » Needs work

The tiny test I submitted in #21 was completely rewritten, so I think I can still review this. The approach is correct, as are the tests that check it. I think the locales_source changes should be removed from the fixture. It will shrink the patch, and they are an easy enough hunk to remove. They aren't necessary for working in the UI, they just get inserted while working in the UI anytime t() encounters a new string. I think with them removed this is ready to go.

quietone’s picture

Status: Needs work » Needs review
FileSize
13.34 KB
26.42 KB

Thanks for explaining about locales_source.

Rather tired but I've gone ahead and removed that changes to locales_source. Let's hope my fingers are working well.

mikelutz’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to go, and a more manageable size. Thanks!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 40: 2754493-40.patch, failed testing. View results

mikelutz’s picture

Status: Needs work » Reviewed & tested by the community

Random test fail..

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Looks good to me! Thanks all!

  • Gábor Hojtsy committed e80f905 on 8.7.x
    Issue #2754493 by quietone, mikelutz, vacho, vasi, masipila: D6...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.