Problem/Motivation
In order to be able to identify a given migration as multilingual, we need to migrate the content type translation settings for the different content types.
Proposed resolution
Content type translation setting variables:
- language_content_type_$type (one for each content type). Has 4 possible states:
- No value: Means no translatable.
- 0: Means no translatable.
- 1: Means has language.
- 2: Means has language, and it is translatable.
- i18n_newnode_current_$type (one for each content type). A checkbox that indicates if the current language is the default for new content.
- i18n_required_node_$type (one for each content type). A checkbox that makes language required (neutral not allowed).
- i18n_lock_node_$type (one for each content type). A checkbox that makes the language locked, so it cannot be changed on edit.
- i18n_node_$type (one for each content type). Has 4 possible states:
- No value: not applicable, no translatable.
- 1: All enabled languages allowed.
- 2: All defined languages allowed.
- 3: All defined languages allowed, but not displayed in links.
- language_content_type_negotiation ?
- language_content_type_default ?
Target: language.settings.yml
entities:
node:
article:
language:
default_configuration:
langcode: current_interface
language_show: true
Original report by Ryan Weal
Content type translation settings (D6/D7 core content translation and entity_translation contrib -> D8 content type config). This will bring what language settings are allowed for content authors of a particular content type. It will determine what the translation method was (content translation == 1 node per language, entity_translation = 1 und node with translatable fields). Config here specifies if it is possible to set langauge_none/undefined/language neutral/UND or if setting a language is mandatory.
| Comment | File | Size | Author |
|---|---|---|---|
| #43 | 2225271-43.patch | 11.8 KB | penyaskito |
Comments
Comment #1
pcambraComment #2
rvilarComment #3
penyaskitoComment #4
penyaskitoComment #5
rvilarI'm unassigning me from this issu beacuse I can't work on this issue at the moment.
Comment #6
penyaskitoComment #7
penyaskitoComment #8
penyaskitoWork in progress...
Comment #9
penyaskitoNew patch. Includes custom destination and the migration itself. Migration tests looks good, but needs to be expanded.
Most of the variables we had are not longer necessary because those features are not there (they don't make sense anymore, or they would be at contrib). Not sure if those should be documented on the source (as they are now) or moved to the migration yml.
I just found source test coverage is insufficient too, I thought I had this already covered.
Sorry, no interdiff.
Comment #10
benjy commentedPatch attached has a POC for the use of a Load plugin instead. It's just a fork of LoadEntity and would need some clean up. Posting here for discussion.
Comment #11
penyaskitoPostponed on #2355909: language.settings config is not scalable
Comment #12
penyaskitoI should come back to this one.
Comment #13
phenaproximaComment #14
phenaproximaBlocked by #2594263: Add translation data to Migrate Drupal's test fixtures.
Comment #15
phenaproximaOK, this is unblocked :) But it's a year old so it positively aches for a re-roll...
Comment #16
phenaproximaRe-blocked by #2596793: Migrate legacy languages to configurable language entites.
Comment #17
svendecabooterUnblocked
Comment #18
svendecabooterThis functionality has changed quite a bit since the last patch.
Attached is a new patch based on the work by penyaskito & benjy.
It migrates the D6 content type language settings that are appropriate in D8.
Still needs test, and a check to see if this can be generalised for D7 as well.
Comment #19
svendecabooterPatch attached that migrates from D6 and D7.
Still needs tests.
Comment #20
svendecabooterComment #21
catchComment #22
quietone commentedA test for D7 only, with a schema error. How to fix that?
Also, penyaskito, in #9, talked about where to put comments about the variables that are no longer necessary. I've tried to put that in the yml template. It seems the best place to look to get an overview of what the migration will do.
Comment #23
quietone commentedDon't know what happened but I needed to upload the patch and interdiff again.
Comment #25
quietone commentedI know it is late but the D6 migration looks wrong to me. The D6 migration template is essentially the same as the D7 one. But the D6 i18n variables are different and they are using the same source plugin, which is specific to D7.
Seems to be for D7 not D6.
D6 doesn't have a variable i18n_node_options_
The lock variable for D6 is i18n_lock_node_$type
Comment #26
quietone commentedFor a bit of clarity the D6 and D7 versions are separated in this patch.
Comment #27
quietone commentedSo there are now tests for D6 and D7 that are passing.
Comment #28
quietone commentedComment #30
penyaskitoRerolled #26. 3-way merge worked automatically, let's see the results.
Comment #32
penyaskitoMigrateDrupalNTestBase were moved, so need to update the use statement.
These are green locally.
Comment #33
penyaskitoComment #34
quietone commented@penyaskito, thanks.
Made two changes:
Comment #35
vasi commentedSome preliminary notes on review:
For the properties that we're setting, we need to verify that they do the right things
* default_langcode: current_interface?
* language_alterable meaning?
* Is content_translation/enabled really tri-valued? NULL/TRUE/FALSE
* What about the fields themselves, are they marked translatable?
Tests need to check that non-translatable types have correct settings, too
We do a test for system schema >= 7000 in the d7 source, shouldn't that be always true?
Should we separate or coalesce d6/d7?
Comment #36
vasi commentedI did a brief review of the fields we're setting on the language_content_settings config entity:
Also, I actually tried to do a migration with this patch, and it worked well! The fields are indeed marked as translatable, since that's the default. So the remaining issues for me are:
Comment #37
penyaskito@vasi:
We want that content to be in the language negotiated by the page. Using 'site_default' would mean using the default language of the site.
Added
Done
We are using all the types as a source, so we would need to modify the patch for that. I'm not sure if it's worth it. I added assertions for ensuring that they have the default configuration instead.
TBD:
NR just for the tests, should be back to NW afterwards.
Comment #39
penyaskitoTests are green, next steps:
Are there any types already that meets those conditions in d6/d7 dumps?
Comment #40
vasi commentedBut we are using skip_on_empty to skip the ones that are not actually translatable. No patch modifications should be needed.
I think there's none, you're right. It would be nice if language_alterable = TRUE was tested, but it's probably not worth changing the dumps.
Comment #41
penyaskitoAdded the dump modification so we can test that, and added the new test. For that I had to fix a bug in the source, so thanks for asking for that test ;-)
Comment #42
penyaskitoTagging with the DrupalNorth sprint, sorry for the noise.
Comment #43
penyaskitophpcs complained about a couple of things, fixed those.
Comment #44
vasi commentedLooks good!
Comment #47
catchCommitted/pushed to 8.2.x and cherry-picked to 8.1.x. Thanks!