Problem/Motivation
This is a D7 follow-up to #2886609: Migrate translations for D6 i18n taxonomy 'localized' terms
Drupal 7 i18n_taxonomy provides two different multilang concepts: 'localized terms' and 'per language terms'.
The scope of this issue is to migrate the translations of the D7 'localized' terms to D8.
Proposed resolution
The scope of this issue is to migrate D7 taxonomy term translations.
D7 vocabulary translation settings are handled in #2979970: Migrate D7 vocabulary language settings
References between translated nodes and translated terms are handled in #3035392: Migrate vocabulary translations and taxonomy term references for Drupal 7 node translations
Remaining tasks
1. Write a patch.
2. Test manually and review the patch.
3. Commit
User interface changes
N/A
API changes
N/A
Data model changes
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | 2979964-30.patch | 33.99 KB | quietone |
| #30 | interdiff-27-30.txt | 985 bytes | quietone |
| #27 | 2979964-27.patch | 33.31 KB | quietone |
| #27 | interdiff-25-27.txt | 412 bytes | quietone |
| #25 | 2979964-25.patch | 32.74 KB | quietone |
Comments
Comment #2
masipila commentedPostponed on #2886609: Migrate translations for D6 i18n taxonomy 'localized' terms.
Comment #3
masipila commentedComment #5
masipila commentedUnpostponed as this landed: #2886609: Migrate translations for D6 i18n taxonomy 'localized' terms
Comment #6
heddnTriaging the issue queue.
Comment #7
quietone commentedComment #8
masipila commentedReferences between translated nodes and translated terms were pointing to the D6 issue. Fixed to point to D7 issue.
Comment #9
quietone commentedI've been looking at this and it is very different than Drupal 6. Here, the taxonomy_term_data table has an additional field for the language meaning the translated terms for all vocabulary multilingual types are stored here and not in i18n string table. I don't think a separate migration will be needed for localized terms and this can be closed.
However, leaving this open while work progresses on the migration of translated term in #2979966: Migrate D7 i18n taxonomy term language.
Comment #10
papagrande@quietone I'm a little confused on this because I have taxonomies with localized terms and the translations aren't migrating over. If a separate migration isn't needed, then can you point to how it should be done?
At quick glance, it looks like the terms are referenced in the i18n_string, locales_source, and locales_target D7 tables and I don't see them referenced in d7_taxonomy_term or the patch at https://www.drupal.org/files/issues/2019-04-25/2979966-21.patch.
Comment #11
idebr commented#9 Actually for 'localized' terms, the data structure is pretty much identical to D6:
D6 (copied from #2886609: Migrate translations for D6 i18n taxonomy 'localized' terms):
D7:
Comment #12
pieterdcI agree with comment #10 in thinking this ticket is still needed. And curious about the other approach if it isn't needed.
#2979966: Migrate D7 i18n taxonomy term language only adds language information for migration the source language version of a taxonomy term.
We still need something to migrate the translations.
Created a patch based on the hint from #11, but without test coverage.
Changed:
Comment #13
pieterdcCreated patch from above the Drupal root. Corrected that in patch. See attached.
Comment #14
heddnComment #16
quietone commentedYea, this is needed. I just got mixed up.
This needs a test so I started one. I have not added an interdiff since it is the same size of the patch, which is now large since a fixture change was required.
Comment #17
quietone commentedComment #18
quietone commentedNow, reduce the size of the fixture which will also fix some of the tests. The interdiff excludes changes to the fixture.
Comment #19
quietone commentedThe query should be changed so that this is language. At least I think that was done in another issue.
Need to find out if this can use I18nQueryTrait
Comment #21
quietone commented1. No change. The language field is set in the parent query so let's keep this simple. I've added a comment to the migration to help explain the unusual name.
2. Can't do this either. The trait was made assuming the objectid in the i18n_string or i18n_strings table is test. However, for taxonomy terms it is the tid, an integer, for the term. So that won't work. However, I reworked prepareRow to use as much of the same code as possible for consistency.
Comment #22
quietone commentedThis is based on the D6 version and thus is fairly straight forward. I haven't done a self review, I just wanted to get all the tests passing.
Can anyone do some manual testing?
Reviews welcome.
Comment #23
gábor hojtsyThis looks good to me, thanks for the added docs on the unusual field name.
Comment #24
gábor hojtsyComment #25
quietone commentedThis needs a reroll.
There is a change in that the instead of the migration of i18n_taxonomy being set to 'finished' I have kept it at 'not_finished' pending on the completion of #3035392: Migrate vocabulary translations and taxonomy term references for Drupal 7 node translations. That seems reasonable to me. Agree?
Comment #27
quietone commentedAnd test for i18n_taxonomy and i18n_translation in the will not be upgraded list.
Comment #28
gábor hojtsyThanks for the reroll. I agree keeping this marked unfinished is the right way to go.
Comment #29
larowlanwhat happened to these?
is there a performance cost of doing this for each row? any way it can be done in a single query for all rows?
Comment #30
quietone commentedThanks larowlan!
#29.1 I've restored the two rows that were accidentally removed from i18n_string, now using with an previously unused 'lid'. There are no translations for those fields so nothing else to change.
#29.2. The first issue (whatever it was) where I needed to do this I did try to get both translations in the query() method but then the query wasn't joinable. This same technique is uses in d7/BlockCustomTranslation and d6/MenuLinkTranslation source plugins. I'm pretty sure this getting the 'other' translation in prepareRow() was discussed at a migrate meeting when this way of getting the translations was first implemented.
Comment #31
gábor hojtsyLot of these (and more above) don't actually seem to be appearing in tests or are their translations there?
Comment #32
quietone commentedThose changes are to the locales_source table and do not have any effect on the migration or the tests. They are not necessarily for items that have a translation, that is the locales_target table may not have an entry with the same lid.
However, those changes are needed for a D7 site using the test fixture to work as expected. I confirmed this by removing those changes, imported the test fixture and navigating to admin/structure/taxonomy/vocabulary_name_much_longer_than_thirty_two_characters/translate which should not have a translation but now does and it is incorrect, pointing to a translation for something else (didn't bother to find out what it was). That makes the fixture unusable for creating a new dump.
Comment #33
gábor hojtsyOk, right, well, they are merely the sources for possible translations, ok.
I did not find any other parts that were concerning.
Comment #34
larowlanCommitted 07c4124 and pushed to 8.8.x. Thanks!
Comment #36
quietone commented@larowlan, thanks for the commit.
Changing back to fixed since this has been committed
Comment #37
quietone commentedOh, dear this is missing a test of the source plugin! Follow up added #3073442: Add test of d7 term localized source plugin
Comment #39
xjmI think we should highlight a list of all the significant improvements to multilingual migrations in 8.8 (whether or not the module stabilizes in this release). Tagging accordingly!
Comment #40
mariaioann commentedShouldn't the localized term description formats be migrated as well as part of this migration?