tl;dr:
On localized menu links from a D7 source, the language is not migrated and the default menu language is assigned to all links.

Description:
I added the configuration for migration from a D7 site using migrate-upgrade and drush8:
drush migrate-upgrade --legacy-db-url=mysql://db:db@localhost/db7 --legacy-root=http://localhost:8087 --configure-only

I executed only the menu and menu links migrations (they do not have other dependencies, as long as the menus have absolute paths)

drush ms | grep menu
  Import from Drupal 7 (migrate_drupal_7)   upgrade_menu_settings                             Idle     0       0          0                                 
  Import from Drupal 7 (migrate_drupal_7)   upgrade_d7_menu                                   Idle     12      12         0             2018-11-14 14:54:18 
  Import from Drupal 7 (migrate_drupal_7)   upgrade_d7_menu_links                             Idle     298     298        0             2018-11-14 14:54:50 
  Import from Drupal 7 (migrate_drupal_7)   upgrade_node_translation_menu_links               Idle     298     0          298                               
drush migrate:import upgrade_d7_menu
drush migrate:import upgrade_d7_menu_links

Now I have the menus in my new D8 site, and I also have the links. All of the links however point to the default language.
D7 db entries:

MariaDB [db7]> select language, link_title from menu_links where menu_name like "menu-main%" order by link_title limit 15;                           
+----------+--------------+
| language | link_title   |
+----------+--------------+
| fr       |  Jeunesse    |
| fr       | 2017 Thoune  |
| de       | 2017 Thun    |
| it       | 2017 Thun    |
| fr       | 2018 Zoug    |
| de       | 2018 Zug     |
| it       | 2018 Zugo    |
| it       | 2019 Chillon |
| de       | 2019 Chillon |
| fr       | 2019 Chillon |
| it       | 360°         |
| fr       | 360°         |
| de       | 360°         |
| fr       | A paraître   |
| de       | Aargau       |
+----------+--------------+
15 rows in set (0.00 sec)

D8 db entries:

MariaDB [db8]> select langcode, title from menu_link_content_data where menu_name like "menu-main-navigation" order by title limit 15;               
+----------+--------------+
| langcode | title        |
+----------+--------------+
| de       |  Jeunesse    |
| de       | 2017 Thoune  |
| de       | 2017 Thun    |
| de       | 2017 Thun    |
| de       | 2018 Zoug    |
| de       | 2018 Zug     |
| de       | 2018 Zugo    |
| de       | 2019 Chillon |
| de       | 2019 Chillon |
| de       | 2019 Chillon |
| de       | 360°         |
| de       | 360°         |
| de       | 360°         |
| de       | A paraître   |
| de       | Aargau       |
+----------+--------------+
15 rows in set (0.01 sec)

One would expect that the language should be migrated too.
It is possible to change the language from the DrupalUI afterwards, so Drupal 8 is configured correctly to handle multilingual menus.

I mark this as major, since it makes the migration not usable from/to multilingual sites. Please feel free to change.

Comments

bserem created an issue. See original summary.

bserem’s picture

Project: Migrate Upgrade » Drupal core
Version: 8.x-3.x-dev » 9.x-dev
Component: Code » ajax system
bserem’s picture

Version: 9.x-dev » 8.6.x-dev
Component: ajax system » migration system
zekvyrin’s picture

bserem’s picture

Title: Menu language not properly migrated » Menu language not properly migrated from D7 localized menu links.
Issue summary: View changes
Issue tags: +migrate-d7-d8, +localization
zekvyrin’s picture

Status: Active » Needs review
zekvyrin’s picture

Noticed that all the menu links after migrate had the same language, which isn't true for our case.
The original language was replaced by the default language of the menu.

With this patch the migrated menu links have the same language like the original menu links in d7.

bserem’s picture

Status: Needs review » Reviewed & tested by the community

I added the patch on a 8.6.3 installation and executed the migration again.

This time the menu in Drupal 8 has been imported along with the proper languages, something that I can verify inside the sql tables:

MariaDB [db8]> select langcode, title from menu_link_content_data where menu_name like "menu-main-navigation" order by title limit 15;
+----------+--------------+
| langcode | title        |
+----------+--------------+
| fr       |  Jeunesse    |
| fr       | 2017 Thoune  |
| de       | 2017 Thun    |
| it       | 2017 Thun    |
| fr       | 2018 Zoug    |
| de       | 2018 Zug     |
| it       | 2018 Zugo    |
| de       | 2019 Chillon |
| fr       | 2019 Chillon |
| it       | 2019 Chillon |
| de       | 360°         |
| fr       | 360°         |
| it       | 360°         |
| fr       | A paraître   |
| de       | Aargau       |
+----------+--------------+
15 rows in set (0.00 sec)
zekvyrin’s picture

catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

This could do with a test addition.

bserem’s picture

We had a discussion with @stefanospetrakis in Mountaincamp Davos where he informed us about the existence of fixtures. We'll try to revive this thread and come up with an updated patch, hopefully with his help.

stefanos.petrakis’s picture

true words, already had a go at it on my local dev, would like to post some tests here that cover this case as soon as I have something presentable to share.

bserem’s picture

stefanos.petrakis’s picture

Version: 8.6.x-dev » 8.8.x-dev
Status: Needs work » Needs review
StatusFileSize
new61.9 KB
new62.43 KB

Here are some tests that try to capture this scenario.
First patch (tests only) should fail.
Full patch (tests and #4) should pass.

stefanos.petrakis’s picture

Updated tests for 8.8.x

quietone’s picture

Thanks for the patch.

What caused the additional column, language, to the menu_custom table?

stefanos.petrakis’s picture

Hi

We need to add language information to the source fixtures data, which is saved in the language column.

quietone’s picture

@stefanos.petrakis, What module adds the language column? i18n_menu?

stefanos.petrakis’s picture

@quietone: Good question, one for @bserem I believe to answer.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone’s picture

It is i18n_menu, from i18n_menu.install

/**
 * Implements hook_schema_alter().
 */
function i18n_menu_schema_alter(&$schema) {
  $schema['menu_links']['fields']['language'] = array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => LANGUAGE_NONE);
  $schema['menu_links']['fields']['i18n_tsid'] = array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0);
  $schema['menu_custom']['fields']['language'] = array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => LANGUAGE_NONE);
  $schema['menu_custom']['fields']['i18n_mode'] = array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0);
}
quietone’s picture

We also need to make sure that the d6 test fixture functions in a D6 site. Ideally, one would bring up a D6 site with the test fixture, enable i18nmenu and make alterations via the UI for the menu language. I presume a menu will need to have 'localize' selected and some translations added. Once that is done, use db-tools to dump that database to drupal6.php. See Generating database fixtures for D8 Migrate tests.

quietone’s picture

Status: Needs review » Needs work

Needs work for the points in #23

quietone’s picture

Add tag and parent.

quietone’s picture

Status: Needs work » Closed (duplicate)

The work here is now included in #3008028: Migrate D7 i18n menu links so closing this as a duplicate and added credit over there.