Problem/Motivation
In Drupal 6 Node translation concept each language version is a separate node with their own nid. Each of these nodes can have their own taxonomy term references.
In Drupal 6, you can use the I18n Taxonomy module to translate a taxonomy vocabulary and taxonomy terms. There are two different multilang concepts: 'localized' and 'per language'.
- In 'localized' concept there is only one term entity (title and description can be translated with string translation).
- In 'per language' concept each term is a separate term entity with their own tid.
- More detailed explanation of the multilingual taxonomies can be found at https://www.drupal.org/docs/8/upgrade/upgrading-multilingual-drupal-6-to...
This issue is about the references from the migrated Node translations to the terms. Currently the translation of the node does not get the reference to the taxonomy term. Only the primary language version of the node has the reference to the term in Drupal 8.
Proposed resolution
Related issues out of scope of this issue:
- Migrating the translation of the 'localized' taxonomy term is handled separately in #2886609: Migrate translations for D6 i18n taxonomy 'localized' terms.
- Migrating the vocabulary settings is handled separately in #2975509: Migrate D6 vocabulary language settings.
The scope of this issue is the reference from the node translation to the taxonomy term.
Test case 1 when using 'Localized' vocabulary.
- Have two node entities in Drupal 6, one in English (nid 1) and one for example in Finnish (nid 2). Associate these as translations of each other.
- Have one taxonomy term in Drupal 6 which is translated in Drupal 6 at admin/build/translate. The vocabulary must have the 'Localized' multilingual setting.
- Make sure that both English and Finnish versions of the Drupal 6 node have a reference to the term.
- The translation of the term and the vocabulary language settings must have been previously migrated, see #2886609: Migrate translations for D6 i18n taxonomy 'localized' terms and #2975509: Migrate D6 vocabulary language settings.
Expected result:
- The Finnish language version of the node is migrated as a translation to the English node. In other words, there were 2 nodes in Drupal 6 but there will only be 1 node in Drupal 8.
- When viewing the Finnish translation of the Drupal 8 node, it must have a reference to the term.
Implementation:
The localized vocabulary is 'field_vocabulary_name_much_longe' on the content type 'employee'.
Two nodes in the employee content type.
John Smith - EN
field_vocabulary_name_much_longe: 'term 4 of vocabulary 3': source tid 4
John Smith - FR
field_vocabulary_name_much_longe: 'fr - term 4 of vocabulary 3': source tid 9
Test case 2 when using 'Per language' vocabulary.
- Have two node entities in Drupal 6, one in English and one for example in Finnish. Associate these as translations of each other.
- Have two taxonomy terms in Drupal 6. The vocabulary must have the 'Per language' multilingual setting. Both taxonomy terms will have their language defined.
- Make sure that the English node has a reference to the English term in Drupal 6.
- Make sure that the Finnish node has a reference to the Finnish term in Drupal 6.
Expected result:
- The Finnish language version of the node is migrated as a translation to the English node. In other words, there were 2 nodes in Drupal 6 but there will only be 1 node in Drupal 8.
- When viewing the English version of the Drupal 8 node (original language of the node), it must have a reference to the English term.
- When viewing the Finnish translation of the Drupal 8 node, it must have a reference to the Finnish term.
Implementation:
The per language vocabulary is 'field_vocabulary_3_i_2_' on the content type 'employee'.
Two nodes in the employee content type.
John Smith - EN
field_vocabulary_3_i_2_: Vulcan: source tid 15
John Smith - FR
field_vocabulary_3_i_2_: fr - Talos IV: lid 1692 : source tid 14
Remaining tasks
Patch
Test & Review
Commit
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Original issue report by @jhodgdon
I tested today migrating a D6 site that had:
- One content type with translations into Spanish (using Content Translation and i18n and CCK translation)
- One taxonomy vocabulary with translations into Spanish (using i18n taxonomy)
- This taxonomy vocabulary was on this content type
The English nodes and taxonomy terms came through OK.
The Spanish taxonomy term translations didn't migrate. This is #2886609: Migrate translations for D6 i18n taxonomy 'localized' terms.
Also, the Spanish nodes did not have taxonomy terms assigned to them. That is what this issue is about: to fix that (but first it requires that the taxonomy translations are migrated).
Related investigation of the 'Per language' concept
#2979486: Migrate D6 'per language' multilingual vocabularies & terms
| Comment | File | Size | Author |
|---|---|---|---|
| #62 | 2859297-62.patch | 14.17 KB | quietone |
| #59 | 2859297-59.patch | 14.17 KB | quietone |
| #59 | interdiff-54-59.txt | 2.79 KB | quietone |
| #54 | interdiff-40-54.txt | 568 bytes | quietone |
| #54 | 2859297-54.patch | 10.99 KB | quietone |
Comments
Comment #2
jhodgdonNote: maybe this issue will be fixed when taxonomy migrates correctly, but it probably at least needs a test added here.
Comment #3
gábor hojtsyI think there are entity reference migration problems overall that may be more related to this, given taxonomy terms are a special case of entity reference now. I suspect the field is set translated but the translations entity references never get the taxonomy term value set.
Comment #4
gábor hojtsyHm, so as per @catch the main reference issue outstanding is #2447727: Add base class for migrating reference fields which is not Drupal 6 related on a cursory look. So may not get you a solution there...
Comment #5
jhodgdonNow that taxonomy terms and vocabularies migration is in, probably this needs a retest to see if it is still a problem. I'll try to make time for that sometime soon.
Comment #6
jhodgdonI retested today. What I did:
a) Install today's Drupal 8.4.x with Minimal install profile in English, using the install UI.
b) Install the Migrate, Migrate Drupal, and Migrate Drupal UI modules from admin/modules.
c) Went to /upgrade (migrate UI page). This advised me to install modules on this site that were used on the d6 site, so I installed Taxonomy, Comment, Custom Block, Path, Views, all the field types except Telephone, and the i18n modules.
d) Went back to /upgrade and did the migration from there, of the site described in the issue summary (with translated taxonomy terms being used on translated nodes). It took a while...
e) Went to the Text Formats page and resaved 2 text formats that have missing filters from a contrib module that isn't ported, so I could see the content and not get confused about whether it migrated or not.
So, the result, regarding taxonomy and this content type:
1. I don't see any translations of my taxonomy terms coming in. I'll comment on the related taxonomy term migration issue.
2. The taxonomy vocabulary is not translated as far as I can see either. I'll comment on the vocabulary issue.
3. The nodes came through in English with Spanish translations, but the Spanish translations have no tags.
So... I think this is still a problem.
Comment #7
jhodgdonAdded #2886609: Migrate translations for D6 i18n taxonomy 'localized' terms ... this needs to be postponed until that issue is fixed.
Comment #8
quietone commentedAdd tag.
Comment #11
gábor hojtsy#2886609: Migrate translations for D6 i18n taxonomy 'localized' terms landed.
Comment #12
masipila commentedWe need to do the same thing for D7-D8. What do others think, should we open a separate issue for that or increase the scope of this issue to cover both?
Comment #14
quietone commentedAdd tag.
Comment #15
masipila commentedUpdated issue summary as part of clarifying the scope for each of the multilingual vocabulary / term migration issues.
Comment #16
masipila commentedPostponed on #2886609: Migrate translations for D6 i18n taxonomy 'localized' terms. The other related issue is a soft blocker as the multilingual settings of the vocabulary can be easily modified manually in D8 #2975509: Migrate D6 vocabulary language settings.
Comment #17
masipila commentedComment #18
masipila commentedFurther updates to the issue summary.
Postponed on #2886609: Migrate translations for D6 i18n taxonomy 'localized' terms. The other related issue is a soft blocker as the multilingual settings of the vocabulary can be easily modified on Drupal 8 site, see #2975509: Migrate D6 vocabulary language settings.
Comment #19
masipila commentedComment #20
masipila commentedUnpostponed as this landed: #2886609: Migrate translations for D6 i18n taxonomy 'localized' terms. The D7 part might need a separate follow-up.
Comment #21
heddnTriaging the issue queue.
Comment #22
quietone commentedFor test case 1:
Add a localized taxonomy term to the employee content type and add data. Then add a test for the migration of localized term on a translated node. But the test fails in the migration with
Next is to find out why it doesn't just update the entity.
Comment #24
quietone commentedAh, I forgot to add 'translations: true' to the migration.
Comment #25
quietone commentedRemove some test code and comments left in the previous patch by mistake.
This adds 'translations: true' to the destination in d6_term_node_translation.yml allowing the translation to be saved. But the vid wasn't being updated and found that d6_term_node_translation needed to be added to the list of plugins altered in migrate_drupal_migration_plugins_alter in migrate_drupal. Then found that the vocabulary Id being saved for the translated node was the same as for the untranslated node. Changing the vocabulary field to be translatable fixed that. That was done in d6_vocabulary_field_instance.yml and I'm sure other tests will fail because of that. So, stopping now to see what testbot finds.
Comment #27
quietone commentedThe interdiff for the above patch
Comment #28
quietone commentedAdd source data and test for test case 2, 'per language'. Also, some cleanup and comments.
Comment #30
quietone commentedReroll because #2754493: D6 synchronized field settings aren't migrated properly was committed.
Comment #32
quietone commentedTrimming the changes to the fixture.
Comment #34
quietone commentedAdjust the field entity count
Comment #36
quietone commentedFix for Upgrade6Test.
Comment #38
quietone commentedChange the migrate_drupal plugin_later to only add d6_term_node_translation if the module config_translation is installed.
Comment #40
quietone commentedNeed to enable config_translation too!
Comment #41
quietone commentedJust want to double check that the source data matches the recommendation in the IS.
Comment #42
quietone commentedAdded the implementation of the Case scenarios to the IS. It looks like the cases are covered. Therefor this is ready for review.
Comment #43
quietone commentedComment #44
jhodgdonWould it help for me to go back to my D6 actual site that triggered me filing this issue, and test it again with this patch?
Comment #45
quietone commented@jhodgdon, yes! Much appreciated.
Comment #46
jhodgdonI did a manual test of this patch today. See comment #6 for my test procedure (changes: I started with Standard install profile not Minimal, so I had fewer additional modules to install, and I used 8.7.x with the patch in #40 applied). See the "original report" section of the issue summary for a description of the D6 site that I was testing with.
So, results:
a) I got two errors that look like this during taxonomy migration:
b) Woot!! My translated vocabulary came through with translated terms! I guess that was a different issue. Anyway, that's good. I'm not sure I'd tested since that was fixed.
c) Woot!! My bilingual blog posts came through with taxonomy on them, and when I view them, I see the appropriate translation. So, that's good too.
So... I don't know if (a) is related to this issue or not, but it doesn't seem to have caused a problem, at least for the spot check of content I looked at.
Comment #47
quietone commentedAwesome, 2 'Woot!!'s. It was nice to see that this morning.
Now the error message in 46.a is interesting. I can't find where it is created in my local Drupal 6. So, I went to http://cgit.drupalcode.org/i18n/tree/i18nstrings/i18nstrings.install?h=6... and found it is created in this:
but my local has
The difference is that one has a column of 'i18n_status' and the other is 'status'. The change is in the last commit before The Great Git Migration. So, do we handle both situations or not? I don't recall if there ever was a decision for migrate to handle the latest dev version or the latest release of a module and I don't think we have ever run into a similar situation. But, to answer my question, I think common sense rules and both table schemas should be handled. Someone correct me if I am wrong.
Comment #48
quietone commentedThe error in #46.a is not caused by this patch so it is moved to a new issue #3035259: Unknown column 'lt.i18n_status' in 'field list'.
Comment #49
masipila commentedI reviewed patch #40 and repeated the manual test. So we have now two independent manual tests, first by @jhodgdon and now from me.
Test results from my manual tests:
D6 test setup
Test 1 against the acceptance criteria of the issue summary:
Test 2 against the acceptance criteria of the issue summary:
Test results
Test 1:
Test 2:
Patch review results
I reviewed the patch. It looks good to me. The D6 fixture has test data for both tests described above and there is test coverage for both tests.
Conclusion:
Cheers,
Markus
Comment #50
masipila commentedQueued the latest patch also for PostgreSQL and SQLite to be on the safe side.
Comment #51
masipila commentedRemoved the TODO item from the issue summary on the D7 evaluation. I opened #3035392: Migrate vocabulary translations and taxonomy term references for Drupal 7 node translations as a D7 follow-up for this.
Comment #52
quietone commentedRetesting PostgreSQL, some CI error happened.
Comment #53
gábor hojtsyThis should be tagged multilingual, no?
Comment #54
quietone commentedYes, it should! Thanks. All fixed but it looks like there is a PostgreSQL error.
Comment #56
quietone commentedThe MySQL errors are unrelated, Media.Drupal\Tests\media\FunctionalJavascript\MediaStandardProfileTest
Sadly the PostgreSQL one is
Comment #58
quietone commentedResting
Comment #59
quietone commentedThe problem here is that the source plugin id is not including the language and that the query can return rows with a NULL language. That has been fixed and the test updated to test for both the zu and fr translation of a vocabulary which should prevent this in the future.
Comment #60
heddnAll feedback seems addressed.
Comment #61
gábor hojtsy#2981393: Migrate D6 comment type language settings landed, this will need a reroll.
Comment #62
quietone commentedRerolling, which is just a change to the field_config entity count in Upgrade6Test.
Comment #63
masipila commentedQueued for PostgreSQL and & SQLite once more
Comment #64
quietone commentedAh, good thinking masipila.
Comment #65
masipila commentedCan we have an interdiff between 59-62?
Edit: 59-62, not 60-62
Comment #66
quietone commentedBecause of the reroll, the interdiff fails. However, fortunately it was only a one line change and I remember what it was, it was this line.
Comment #67
masipila commentedOk, thanks, fair enough.
I tested this thoroughly (manually) earlier, see #49. Since then, @quietone had to make some changes in #59 to resolve a test failure. @heddn reviewed this in #60.
The test cases for both localized and per language vocavularied are defined in the IS and they as well as their implementation.
Since the automated tests are green on all three databases and all feedback has been addressed, this is ready to land.
Thanks Vicki!
Markus
Comment #69
gábor hojtsyThanks a lot! Committed to 8.8. This cannot be merged to 8.7 at this point due to commit freeze though. Keeping RTBC for 8.7.x.
Comment #71
gábor hojtsyFinally was able to merge in, sorry for the delay.