{"id":14968608,"url":"https://github.com/pushpinderchauhan/migrate_missing_content_translations","last_synced_at":"2026-01-26T03:33:07.586Z","repository":{"id":223077599,"uuid":"445662105","full_name":"erpushpinderrana/migrate_missing_content_translations","owner":"erpushpinderrana","description":"Drupal 7 to Drupal 9 - Migrate only missing content translations","archived":false,"fork":false,"pushed_at":"2022-08-27T20:13:58.000Z","size":116,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-29T09:42:36.267Z","etag":null,"topics":["d7tod9-migration","drupal-migrate","drupal7","drupal9","fieldcollection","i18n","internationalization","migration","migration-tool","migrations","nestedparagraphs","pushpinderdrupal","translation"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erpushpinderrana.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-01-07T21:54:23.000Z","updated_at":"2022-05-04T23:16:58.000Z","dependencies_parsed_at":"2024-02-18T05:29:43.931Z","dependency_job_id":"1cbb7825-7a43-48b5-8335-6e3cf8319a0f","html_url":"https://github.com/erpushpinderrana/migrate_missing_content_translations","commit_stats":null,"previous_names":["erpushpinderrana/migrate_missing_content_translations"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erpushpinderrana%2Fmigrate_missing_content_translations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erpushpinderrana%2Fmigrate_missing_content_translations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erpushpinderrana%2Fmigrate_missing_content_translations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erpushpinderrana%2Fmigrate_missing_content_translations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erpushpinderrana","download_url":"https://codeload.github.com/erpushpinderrana/migrate_missing_content_translations/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239686501,"owners_count":19680537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["d7tod9-migration","drupal-migrate","drupal7","drupal9","fieldcollection","i18n","internationalization","migration","migration-tool","migrations","nestedparagraphs","pushpinderdrupal","translation"],"created_at":"2024-09-24T13:40:17.801Z","updated_at":"2025-12-16T12:30:15.304Z","avatar_url":"https://github.com/erpushpinderrana.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Migrate Missing Content Translations\nIt's a custom module/approach that was developed after the base/initial migration was complete. What it means is while upgrading the website from D7 to D9 the whole content was migrated except translations. There are tons of documents available on the Drupal.org and other forums which describe how to levergae core migration modules to perform the migration from D7 to D9. Though most of the time, there is a need of custom development. The idea of this module is to provide more context to undertstand how can we leverage/extend OOTB migration modules. \n\n# Problem Statement\nMigrate content translations from D7 to D9 when the base migration modules are not available. However, the mapping tables are still there. The ask is to use these mapping tables and based in the tnid in D7, only migrate the translations.\n\n# Solution\nLet's levergae a few of OOTB modules as listed below.\n1. [Migrate Tools](https://www.drupal.org/project/migrate_tools/)\n2. [Migrate Plus](https://www.drupal.org/project/migrate_plus/)\n3. [Migrate Devel](https://www.drupal.org/project/migrate_devel) - It's not a mandatory module and not required on production. It's really helpful during the development.\n4. Create a custom module for the migration i.e. migrate_missing_content_translations\n\n# Custom Module\nSince the existing base/source migration plugins are no longer available hence we can't use the OOTB source and MigrationLookup plugins. Create a custom [Node Translation Source](https://github.com/erpushpinderrana/migrate_missing_content_translations/blob/main/src/Plugin/migrate/source/CustomNodeTranslations.php) and [CustomMigrationLookup](https://github.com/erpushpinderrana/migrate_missing_content_translations/blob/main/src/Plugin/migrate/process/CustomMigrationLookup.php) plugin. Also, there is a need to migrating Field collection from D7 so we also need to write a [FC Source plugin](https://github.com/erpushpinderrana/migrate_missing_content_translations/blob/main/src/Plugin/migrate/source/CustomFieldCollectionItem.php) for getting the Field Collection items from D7. I've added detailed comment in the each config file to understand how it works.\n\n## Migrate D7 Field Collection items to D9 Nested Paragraphs.\nIt's a two step process. First we need to migrate the individual paragraph and once it's complete then link these paragraphs with the correct node. Though, adding the relationship between newly created sub paragraphs and the parent field in the article node requires a custom solution. I tried OOTB Sub Process plugin but it couldn't work in my case so I created a [Custom Nested Paragraph Process](https://github.com/erpushpinderrana/migrate_missing_content_translations/blob/main/src/Plugin/migrate/process/CustomNestedParagraph.php) plugin.\n\nHere's the structure of D9 schema.\n![Article Nested Paragraph in Node](https://github.com/erpushpinderrana/files/blob/master/ARTICLE%20NESTED%20ITEMS%20-%20Article%20Node%20FIeld%20.png)\n![Article Nested Paragraph Storage](https://github.com/erpushpinderrana/files/blob/master/ARTICLE%20NESTED%20ITEMS%20Field%20Storage.png)\n![Article Nested Paragraph Field](https://github.com/erpushpinderrana/files/blob/master/ARTICLE%20NESTED%20ITEMS%20Field.png)\n![Nested Paragraph - Banner Paragraph](https://github.com/erpushpinderrana/files/blob/master/Article%20FC%20Items%20Banner%20Content.png)\n![Nested Paragraph - Hero Paragraph](https://github.com/erpushpinderrana/files/blob/master/Article%20FC%20Items%20Hero%20Content.png)\n\n## Migrate Import Commands.\nFirst migrate the sub child paragraphs and once it's complete then migrate the article node migration.\n\n**Migrate Hero Content Paragraph**\n```\ndrush migrate-import migrate_nested_paragraphs_hero_content\n```\n\nIf we have enabled Migrate devel locally, then we can use the below command (adding `--migrate-debug`) to see the each row in the drush terminal.\n```\ndrush migrate-import migrate_nested_paragraphs_hero_content --migrate-debug\n```\n**Rollback Hero Content Paragraph**\nIn case, we want to rollback the migrated paragraphs hero content then run the below command.\n\n```\ndrush migrate-rollback migrate_nested_paragraphs_hero_content\n```\n**Reset Hero Content Paragraph**\nIn case, if there is any error then we may need to reset the migration. Here's the command for that.\n\n```\ndrush migrate-reset migrate_nested_paragraphs_hero_content\n```\n\n**Run Two Other Migrations**\nThe same way, we need to run the `migrate_nested_paragraphs_banner_content` migration.\n\n```\ndrush migrate-import migrate_nested_paragraphs_banner_content\n```\n\nFinally, the article migration.\n\n```\ndrush migrate-import migrate_article_translations\n```\n\n**Migrate only one or couple of content**\n```\ndrush migrate-import migrate_article_translations --idlist=573461\n```\n\n```\ndrush migrate-rollback migrate_article_translations --idlist=573461\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpushpinderchauhan%2Fmigrate_missing_content_translations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpushpinderchauhan%2Fmigrate_missing_content_translations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpushpinderchauhan%2Fmigrate_missing_content_translations/lists"}