Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The d7 menu translations need a migration
Proposed resolution
Migrations
- Add menu migration, d7_menu_translation.yml
- add langcode to d7_menu.yml
Source plugins
- Update Menu.php and source plugin test
- Add MenuTranslation.php
Tests
- aAdd source plugin test MenuTranslationTest.php
- update MigrateMenuTest
- add MigrateMenuTranslationTest
- update entity counts in Upgrade7Test
Update migration state in config_translation.migrate_drupal.yml
Fixture changes, drupal 7 - Add translations of menus
Remaining tasks
- Re-roll
- Release manager review for 9.0.x
Comment | File | Size | Author |
---|---|---|---|
#58 | 3112249-58.patch | 18.29 KB | manish-31 |
#51 | 3112249-51.patch | 18.86 KB | quietone |
#51 | interdiff-49-51.txt | 1.26 KB | quietone |
#49 | 3112249-48.patch | 18.86 KB | quietone |
#49 | interdiff-46.48.txt | 929 bytes | quietone |
Comments
Comment #2
quietone CreditAttribution: quietone as a volunteer commentedAnd a first go at the patch. This adds translations of the main menu in both Icelandic and French for both the label and description and a French translation of the description for the test menu.
Comment #4
quietone CreditAttribution: quietone as a volunteer commentedForgot to add i18n_menu to the Upgrade7Test.
Comment #6
quietone CreditAttribution: quietone as a volunteer commentedAdd a menu entity to Upgrade7Test.
Comment #7
quietone CreditAttribution: quietone as a volunteer commentedTrying to reduce the size of the patch by removing changes to the fixture.
Comment #8
quietone CreditAttribution: quietone as a volunteer commentedReroll because #3110669: Migrate d7 menu language content settings was committed.
Comment #10
quietone CreditAttribution: quietone as a volunteer commentedRemove duplicate entry in getMissingPaths().
Comment #11
quietone CreditAttribution: quietone as a volunteer commentedNow it seems very odd to be adding translations of menus when the d7_menu migration doesn't have a process for the language. This adds such a process to d7_menu.yml and modifies the test to check the language. And MigrateMenuTranslationTest has a spelling correction and adds a test for the fixedlang menu.
Comment #12
quietone CreditAttribution: quietone as a volunteer commentedNow move source plugin and tests from config_translation to system.
Comment #13
quietone CreditAttribution: quietone as a volunteer commentedSelf review and found some things to fix. The migration_tag property was missing from the migration. Changed the menu translation source plugin to extend from the menu source plugin and reworked the source plugin methods.
Comment #15
mikelutzThis one looks good to me, I couldn't find any nits
Comment #16
shaktikTest case fails on D9.1, so I am working on it.
Comment #17
shaktikComment #18
shaktikComment #19
shaktikRerolled the patch #13 to made supportable 9.1.x-dev and solved test case issues.
Comment #20
quietone CreditAttribution: quietone as a volunteer commented@shaktik, thanks for the reroll. Can you please provide a diff between the patches in #13 and #19?
Comment #21
shaktikHi @quietone,
Please find the mention below diff between the patches in #13 and #19
Comment #22
shaktikComment #23
quietone CreditAttribution: quietone as a volunteer commentedthis is blocking #3008028: Migrate D7 i18n menu links.
Comment #24
mikelutzI'll put this back to RTBC for 9.1, but I wonder if it should be backported and how far. We may want to re-roll for 8.9 and 9.0, as these migrations are important for the ecosystem.
Comment #25
catchfwiw I am +1 to backporting this to 9.0.x and 8.9.x, even in a patch release if that ended up being necessary. Tagging for a second opinion from @xjm though. Haven't reviewed the patch properly yet.
Comment #26
quietone CreditAttribution: quietone as a volunteer commentedAdded tests for PostgreSQL and SQLlite for the 9.1.x.
Comment #27
quietone CreditAttribution: quietone as a volunteer commentedLooks like the fixture has changed.
Comment #28
quietone CreditAttribution: quietone as a volunteer commentedAnd yet another reroll, this time to update the test fixture.
Comment #30
quietone CreditAttribution: quietone as a volunteer commentedComment #31
quietone CreditAttribution: quietone as a volunteer commentedAnd a version for 8.9 and 9.0
Comment #32
quietone CreditAttribution: quietone as a volunteer commentedNice that all the tests are passing but I want to check the migration state file.
Comment #33
quietone CreditAttribution: quietone as a volunteer commentedThe migration state file is correct. This is ready for review again.
Comment #34
quietone CreditAttribution: quietone as a volunteer commentedForgot to un-assign myself.
Comment #35
quietone CreditAttribution: quietone as a volunteer commentedComment #36
quietone CreditAttribution: quietone as a volunteer commentedComment #37
rajiv.singh CreditAttribution: rajiv.singh as a volunteer and commented#31 worked for D8.9 but adding "(en)" in the label of existing menu links during translation
Comment #38
ravi.shankar CreditAttribution: ravi.shankar at OpenSense Labs commentedHere I have added reroll of patch #31.
Comment #40
quietone CreditAttribution: quietone as a volunteer commented@ravi.shankar, You may not have noticed but there is a 9.1.x patch in #30. The patch in #31 really is just for 8.9.x and 9.0.x. To help reviewers please include an interdiff, or a diff if the interdiff fails, when rerolling patches.
Comment #41
ravi.shankar CreditAttribution: ravi.shankar at OpenSense Labs commentedThanks @quietone
Oh Yes, I didn't notice that there is a patch #30 for Drupal 9.1.x and patch #30 still applies on Drupal 9.1.x.
Please ignore patch #38.
Comment #42
quietone CreditAttribution: quietone as a volunteer commentedThe reroll here should use the fixture changes from #3110669: Migrate d7 menu language content settings.
Comment #43
quietone CreditAttribution: quietone as a volunteer commentedRerolling now that #3110669: Migrate d7 menu language content settings is in.
The diff is very large because the patch in #30 included the work from #3110669: Migrate d7 menu language content settings which is no longer needed in the current patch. The only conflicts during the reroll were to the fixture.
Comment #44
quietone CreditAttribution: quietone as a volunteer commentedThe reroll has been successfull, all tests passing so ready for review.
Comment #45
daffie CreditAttribution: daffie commentedPatch looks good.
In core/modules/field/src/Plugin/migrate/source/d7/FieldOptionTranslation.php they removed those fields and added them with $query->addField(). Should we do here the same?
Should this field not be in $query->addField()?
Which one is the correct language? It is a bit confusing to me.
Why are we doing the same test twice? Maybe changing one of them to "label" instead of "description".
Comment #46
quietone CreditAttribution: quietone as a volunteer commented@daffie, thanks for the review.
1. I don't think so. In FieldOptionTranslation.php the alias is needed for 'type' because is exists on the field_config table as well as the 'i18n_string'. There is no 'type' in another table in the query. The alias was added for 'lid' so that the query could be sorted by the 'lid' field, that isn't being done here. A look at some of the other translation source plugins (FieldLabelDescriptionTranslation, BlockCustomTranslation, BlockTranslation) and it seems that FieldOptionTranslation is unique in making aliases for those fields.
2. It isn't there so that 'language' can be used in the migration and not an alias. Is there a better way to do that?
3. The language used for the source id is the language from the table with an alias of 'lt', which is locales_target. The 'alias' property is not uncommon in getIds() and is well documented at \Drupal\migrate\Plugin\MigrateSourceInterface::getIds. Because of that there is no additional comment.
4. Ah, copy/paste error. Fixed.
Added missing field 'language' and 'plural' to \Drupal\system\Plugin\migrate\source\d7\MenuTranslation::fields
Comment #47
daffie CreditAttribution: daffie commented@quietone: Thanks for your explanation.
All my points are addresed.
All the required testing is in the patch.
All code changes now look good to me.
For me it is RTBC.
Comment #48
quietone CreditAttribution: quietone as a volunteer commentedDid a self review and noticed that the source plugin Menu.php has been changed but the source plugin test wasn't. This adds a test to the existing MenuTest.php.
Comment #49
quietone CreditAttribution: quietone as a volunteer commentedForgot to upload the patch.
Comment #50
daffie CreditAttribution: daffie commentedThe extra testing looks good to me.
Back to RTBC.
Comment #51
quietone CreditAttribution: quietone as a volunteer commenteds/public static $modules/protected static $modules/
Comment #52
daffie CreditAttribution: daffie commentedGood change
Comment #53
larowlanComment #54
larowlanCommitted 61ca2c2 and pushed to 9.1.x. Thanks!
Switching to 9.0.x to - this is tagged Needs release manager review for possible backport.
Comment #56
benjifisherThe patch in #51 does not apply to 9.1.x (since it has already been applied) but it also does not apply to 9.0.x. I think we need a reroll, which is a Novice task.
Comment #57
quietone CreditAttribution: quietone as a volunteer commentedIn order to reroll this the fixture changes from #3110669: Migrate d7 menu language content settings, which did not get committed to 9.0.x, needs to be incorporated. Should we commit that to 9.0.x first or not?
Comment #58
manish-31 CreditAttribution: manish-31 at OpenSense Labs for DrupalFit commentedAdded a patch for Drupal 9.0.x
Comment #60
quietone CreditAttribution: quietone as a volunteer commentedSince this needs the fixture changes from #3110669: Migrate d7 menu language content settings and that migration should be ported as well, marking this as postponed.
Comment #61
quietone CreditAttribution: quietone as a volunteer commentedAdding clarification for the remaining i18n migrations. There are three of these issues that could be backported and they need to be done in this order. One reason is because of the fixture changes.
Comment #63
benjifisherWe decided it is too late to backport #3110669: Migrate d7 menu language content settings, so we will not backport this issue either. Fixed for 9.1.x.