Problem/Motivation

In #2225775: Migrate Drupal 6 core node translation to Drupal 8 we migrated node translations, which doesn't rely on content_translation being enabled. But if we have content_translation enabled, we will want to migrate the source language of the translation, which we can do based on the tnid.

Proposed resolution

Migrate the tnid language to the content_translation_source column if content_translation module is enabled.

Remaining tasks

TBD.

User interface changes

None.

API changes

TBD

Data model changes

None.

Comments

penyaskito created an issue. See original summary.

vasi’s picture

This will probably need an extra join against the node table, to find the source translation for each translation.

mikeryan’s picture

Status: Active » Postponed
Related issues: +#2225775: Migrate Drupal 6 core node translation to Drupal 8
mikeryan’s picture

Status: Postponed » Active
gábor hojtsy’s picture

Yay, that went in now :)

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

@penyaskito: In the issue summary you say:

In #2225775: Migrate Drupal 6 core node translation to Drupal 8 we migrated node translations, which doesn't rely on content_translation being enabled.

I tried migrating D6 translated nodes without enabling content_translation in D8, and only the nodes in the source language got migrated. Also, in the tests included in #2225775: Migrate Drupal 6 core node translation to Drupal 8, content_translation is always enabled, which seems to point to the fact that it is in fact relying on it. Am I missing something here?

maxocub’s picture

Oh, and there's also this comment in D6NodeDeriver:

Translations don't make sense unless we have content_translation.

And this one in MigrateNodeDeriverTest:

Without content_translation, there should be no translation migrations.

So I'm a bit confused by the issue summary.

maxocub’s picture

Status: Active » Needs review
StatusFileSize
new2.71 KB

Here's a first try at it.

gábor hojtsy’s picture

@maxocub: I think you made the translation migration now depend on content_translation in D8, so that is a recent change :) This issue predates that change.

maxocub’s picture

@Gábor Hojtsy: What we did in #2809115: When migrating a multilingual D6 site, the overview page says that the translation upgrade path is missing did not made the translation migration depend on content_translation. That array is only use to construct the upgrade form and to show what paths are available/missing. There's no dependencies enforcement there. The translation migration worked well before that change (provided we enable content_translation).

penyaskito’s picture

At the moment this issue was created, content_translation was not a requirement for having several translations on D8.

The underlying APIs for translating content are not tied to the content_translation module, so even if I don't think anyone would like to implement an alternative UI soon, enabling content_translation shouldn't be a requirement. This may have changed tho since this issue was created.

gábor hojtsy’s picture

No, that did not change. But since the creation of the content translations in Drupal 6 needed the core translation module (alternate implementations were possible but did not emerge at all), it makes sense to tie the migration to the content translation module in Drupal 8 also, otherwise you have no way to manage that data(?) Also what does that mean for this issue, can we translate that to actionable steps? :)

mikeryan’s picture

What's the next actionable step here?

Thanks.

gábor hojtsy’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/node/migration_templates/d6_node_translation.yml
    @@ -29,6 +29,7 @@ process:
       revision_timestamp: timestamp
    +  content_translation_source: source_langcode
    

    This right in the D6 translation migration does not satisfy the summary that this should be dependent on content_translation module. Otherwise this base field is not there.

  2. +++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php
    @@ -96,6 +101,10 @@ public function testNode() {
    +    // Test that content_translation_source is set.
    +    $manager = $this->container->get('content_translation.manager');
    +    $this->assertIdentical('en', $manager->getTranslationMetadata($node->getTranslation('fr'))->getSource());
    

    It would be nice to test with yet another node that has another source langcode? Do we have that in the dump?

maxocub’s picture

Assigned: Unassigned » maxocub

@Gábor Hojtsy: Thanks for the review, I'll make those changes.

maxocub’s picture

Status: Needs work » Needs review
StatusFileSize
new6.33 KB
new5.54 KB

Re: #15:

  1. I added a check to see if content_translation is enabled.
  2. I added a translated node in the dump to test with a source other than English.

Status: Needs review » Needs work

The last submitted patch, 17: 2746293-17.patch, failed testing.

maxocub’s picture

Status: Needs work » Needs review
StatusFileSize
new6.92 KB
new603 bytes
maxocub’s picture

StatusFileSize
new5.34 KB
new2.26 KB

Hmm, I just saw that moduleExists() is available in DrupalSqlBase, so I removed all the useless things to get access to the module handler.

Status: Needs review » Needs work

The last submitted patch, 20: 2746293-20.patch, failed testing.

maxocub’s picture

Status: Needs work » Needs review
StatusFileSize
new6.92 KB

I should have read the doc, moduleExists() on DrupalSqlBase is for the source installation.
So this is the same patch form #19.

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Looks all good to me :)

  • catch committed 5deeece on 8.3.x
    Issue #2746293 by maxocub, Gábor Hojtsy, penyaskito: Migrate...

  • catch committed 0d8f464 on 8.2.x
    Issue #2746293 by maxocub, Gábor Hojtsy, penyaskito: Migrate...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks!

gábor hojtsy’s picture

Issue tags: -sprint

Superb, thanks!

Status: Fixed » Closed (fixed)

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

maxocub’s picture

Assigned: maxocub » Unassigned
maxocub’s picture