Problem/Motivation
This D7 migration has been move out of #2981393: Migrate D6 comment type language settings because the D7 fixture is broken and needs to be fixed before work continues.
Postponed on #3024459: Fix D7 test fixture
In #2981392: Comment migration corrupts data with multilingual sites we found out that the comment type language settings are not migrated sensibly when the source content type has multilingual support enabled.
Migrations generate one comment type for each Drupal 7 content type (except Forum which uses the hard coded comment_forum). The D8 comment type has a default language for new comments, see the screenshot below.
![D8 comment type language settings]()
Currently we leave the default language (for new comments created in D8) to site default language. We also do not show the language selector for comments so that users could change the comment language when they are creating / editing the comments.
Proposed resolution
1. If the Drupal 7 content type has multilingual support 'disabled'.
Drupal 7 fixture: book.
- 'Default language' setting of the comment type: 'Site default'.
- 'Show language selector' setting of the comment type: disabled.
- 'Enable translation' setting of the comment type: disabled.
2. If the Drupal 7 content type has multilingual support 'enabled'.
Drupal 7 fixture: Page.
This means that the nodes can have a language code but the different nodes cannot be linked as translations of each other.
- 'Default language': 'Interface text language selected for page' instead of 'Site default'.
- 'Show language selector': enabled. This way the D8 user can see what the language of the new comments will be.
- 'Enable translation': disabled. This is because the comments in D7 are independent i.e. the comments are not translations of each other.
3. If the Drupal 7 content type has multilingual support 'Enabled, with translation'.
Drupal 7 fixture: article and blog.
This means that the nodes can have a language code and the nodes with different language codes can be linked as translations of each other. The different node language versions will have their independent comments i.e. the comments are not translations of each other.
- 'Default language': 'Interface text language selected for page' instead of 'Site default'.
- 'Show language selector': enabled. This way the D8 user can see what the language of the new comments will be.
- 'Enable translation': disabled. This is because the comments in D7 are independent i.e. the comments are not translations of each other.
4. If the Drupal 7 content type has multilingual support as 'Enabled, with field translation'.
Drupal 7 fixture: test_content_type.
- 'Default language': 'Interface text language selected for page' instead of 'Site default'.
- 'Show language selector': enabled. This way the D8 user can see what the language of the new comments will be.
- 'Enable translation': Depends on the Entity Translation settings in Drupal 7 (admin/config/regional/entity_translation). If the 'Translatable Entity Types' include Comments, then it means that actual comments entities can be translated and D8 'Enable translation' should be enabled. Note: D7-D8 Entity Translation settings were handled in #2073467: Migrate Drupal 7 Entity Translation settings to Drupal 8 and this works correctly at the moment.
Remaining tasks
1. Patch
2. Review and test
3. Commit
User interface changes
Enables the comment language selector + changes the default comment language for multilingual sites.
API changes
None.
Data model changes
None.