Note: This is a clone from https://www.drupal.org/node/2225781 that deals with taxonomy vocabularies. This issue deals with taxonomy terms.

Problem/Motivation

i18ntaxonomy sub module adds two fields to the {term_data} that take care about the translations, we need to create the term entities using the new entity API.

Proposed resolution

We need to create a custom source plugin that takes into account these new fields in {term_data} and also the i18nstrings module features so we can use the new column trid for the migration.

Original report by Ryan Weal

Like nodes, taxonomies can use entity translation. Notes above in nodes should apply.

Comments

mpp created an issue. See original summary.

Gábor Hojtsy’s picture

Status: Needs work » Active

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

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should 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.

quietone’s picture

Looks like adding translations for taxonomy terms needs to be added to the fixture.

Gábor Hojtsy’s picture

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

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should 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.

DamienMcKenna’s picture

Cross-referencing the issue that's blocking this one.

quietone’s picture

quietone’s picture

Assigned: Unassigned » quietone

Should be able to post a first patch in a few days.

quietone’s picture

FileSize
19.09 KB

Here is a rough patch. All the files should be here, the source plugin, migration, tests and changes to the fixture. Although the changes to the fixture needs a closer look. The source plugin test passes locally but the not i18nTaxonomyTermTest. That results in the error below.

No reason to run the testbot.

1) Drupal\Tests\taxonomy\Kernel\Migrate\d6\MigrateI18nTaxonomyTermTest::testI18nTaxonomyTerms
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate 6-0' for key 'PRIMARY': INSERT INTO {taxonomy_term_hierarchy} (tid, parent) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1), (:db_insert_placeholder_2, :db_insert_placeholder_3); Array
(
[:db_insert_placeholder_0] => 6
[:db_insert_placeholder_1] => 0
[:db_insert_placeholder_2] => 6
[:db_insert_placeholder_3] => 0
)
(/opt/sites/d8/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:770)
Failed asserting that false is true.

Jo Fitzgerald’s picture

FileSize
876 bytes
18.68 KB

Here's a little tweak that might shed some light, @quietone (but it still fails, although differently now, hence still not running the testbot).

Jo Fitzgerald’s picture

Assigned: quietone » Unassigned
Status: Needs work » Needs review
FileSize
1.19 KB
740 bytes
18.68 KB

Got it! @quietone you were so close.
#teamwork

Status: Needs review » Needs work

The last submitted patch, 12: 2784371-12.patch, failed testing.

Jo Fitzgerald’s picture

Status: Needs work » Needs review
FileSize
4.23 KB
21.73 KB

Edited a couple of tests to reflect changes to fixture.

I have also reverted a couple of fixture changes that were causing test failures:

  • reinstated url alias for node/1
  • edited hierarchy for two taxonomy vocabularies

@quietone let me know if these should be retained and we'll have edit the tests instead.

Status: Needs review » Needs work

The last submitted patch, 14: 2784371-14.patch, failed testing.

Jo Fitzgerald’s picture

Status: Needs work » Needs review
FileSize
1.18 KB
22.31 KB

Entity count change and a typo.

quietone’s picture

A few more fixes.

1) The yml ids
2) Added a requirement of d6_taxonomy_term to d6_i18n_taxonomy_term
3) Added tests for the parents to the Migration test. The parents are gathered in prepareRow, and should not be changed from the d6_taxonomy_term migration. I guess it isn't strictly necessary to include the parents in the migration.

That still leaves a closer examination of the changes to the fixture.

quietone’s picture

Status: Needs review » Needs work

Just discovered that there is an i18ntaxonomy_vocabulary variable. Anyone know if this needs to be migrated and even better, to what?

On a quick look, I think it is storing these for each vocabulary.
/**
* Modes for multilingual vocabularies.
*/
// No multilingual options
define('I18N_TAXONOMY_NONE', 0);
// Localizable terms. Run through the localization system.
define('I18N_TAXONOMY_LOCALIZE', 1);
// Predefined language for a vocabulary and its terms.
define('I18N_TAXONOMY_LANGUAGE', 2);
// Per-language terms, translatable (referencing terms with different languages) but not localizable.
define('I18N_TAXONOMY_TRANSLATE', 3);

quietone’s picture

Status: Needs work » Needs review
FileSize
20.54 KB
2.43 KB

Trim some more unnecessary changes to the fixture.

Status: Needs review » Needs work

The last submitted patch, 19: 2784371-19.patch, failed testing.

quietone’s picture

Status: Needs work » Needs review
FileSize
19.12 KB
1.18 KB

Ah, apparently I wasn't working from HEAD in #17, removing changes to the Block migration test.