Problem/Motivation
Since #2143291: Clarify handling of field translatability
a few fields are missing from the content translation overview for article, admin/config/regional/content-language
comment settings
image file
tags
Steps to reproduce
To get right before: git checkout -b before 0f752ca6091259af20300ef8d156caa1daea6088
To get right after: git checkout -b after 86e432e05ea1493f0c7cd053470ba676cf2fe7fe
- Install
- Install (Enable) content translation module
- Add a language
- Go to admin/config/regional/content-language
- Check content, and article
Proposed resolution
in #2143291: Clarify handling of field translatability, there was a true/false reversal and it missed a few places, in standard profile node default config, and also in the code for comment settings.
the fix here takes care of those true/false's, and also adds a test.
Remaining tasks
- (done) Find out what the actual problem is
Contributor tasks needed
| Task |
Novice task? |
Contributor instructions |
Complete? |
| Create a patch |
|
Instructions |
done |
| Update the issue summary |
|
Instructions |
done |
| Add automated tests |
|
Instructions |
done |
| Improve patch documentation or standards (for just lines changed by the patch) |
Novice |
Instructions |
done |
| Manually test the patch |
Novice |
Instructions |
done |
| Add steps to reproduce the issue |
Novice |
Instructions |
done |
| Embed before and after screenshots in the issue summary |
Novice |
Instructions |
done |
| Review patch to ensure that it fixes the issue, stays within scope, is properly documented, and follows coding standards |
|
Instructions |
|
User interface changes
No. just fix the regression.
Before in comment #1
After

API changes
No.
Comments
Comment #1
yesct commentedNoticed while working on #1920876: Add a tiny bit of state magic in the image.module and hide the Title and Alt groups when the related form items are disabled
issue probably needs a new title once we figure out what is going on.
missing fields are:
Comment settings
File (image)
Tags
I know adding a new simple text field does show.
Comment #2
gábor hojtsyRaising to critical.
Comment #3
berdirCan you check if a manually added image field does show up?
If that works, then I guess this the default configuration fiels have not been updated, field.field.node.field_image.yml in standard/config/install says translatable: false, but I think that should now be translatable: true.
Try changing that and re-install.
That said, if this is the case, then this is really just a normal bug and easy to fix, regressions are not per se critical (anymore).
Comment #4
yesct commentedYes, fields added via the UI do show.
Comment #5
gábor hojtsyFor the default setup, only the body field is configurable as translatable and it DOES have the translatable checkbox checked but disabled on the field UI (with a description that it needs to have language support for the entity first to have translatability configuration). Is probably somehow related :)
Comment #6
gábor hojtsySo YesCT is working on this. Also demoting per #3.
Comment #7
gábor hojtsyFix typo in title.
Comment #8
yesct commentedthis does make the tags and image file show.
looking into how to change the setting for comments.
@franSeva is also working on this in irc
Comment #9
yesct commented@Gábor Hojtsy helped me in irc find where the comment setting was coming from.
reinstalling with these settings does make the fields show in the overview.
attaching new patch and interdiff.
Still waiting for the test from @franSeva
===============
However, I'm still concerned that the config is being saved for instances with translatable false.
This is concerning because 1) it should be true.
And, if it is false... then why are they being shown as translatable (checked) in the overview.
I installed the config_devel module
and then in
sites/default/files/config_devel
ag "translatable: false"
gives
(user picture is fine. As I understand it... it should be false.)
[edit: added...}
From the db, at first I thought the data was binary, cause phpmyadmin said it was, but when I saved the "bin" file, and opened it, it was readable text with:
s:12:"translatable";b:1;b must be boolean
and...
0 is false
1 is true
so in the db, it's true
why when it writes out the yml is it false?
I tried tracking down how yml gets saved... and haven't yet had luck.
Comment #10
fran seva commented@YesCT oki. I'm on it :)
Comment #11
yesct commentedI'll check back in on this later, especially to see if anyone has ideas about the config saving wrong.
Comment #12
plachIn #2143291: Clarify handling of field translatability we introduced two distinct concepts around field translatability:
translatableproperty of field storage definitions (FieldConfig) determines whether the field supports translation, this in turn determines whether the fields appears in the content translation settings page.translatableproperty can be overridden for each field definition (FieldInstanceConfig), and thus can have per-bundle granularity. This determines whether the field is enabled for translation (checkbox on/off by default). Please note that you can override the storage definition value fromTRUEtoFALSE, but not the opposite, as you can't force a field to be translatable if its storage does not support multilingual values.To sum up the desired (and hopefully implemented :) behavior for configurable fields is:
translatablevalue FALSE by defaultWe probably forgot to move the
translatable: falseline from theFieldConfigfile to theFieldInstanceConfigfile in those cases.Since we are addressing this, we should also check whether comment settings actually work correctly when the field is set to translatable, that is we should check whether we can open/close comments independently for each language. If not we should mark them as
translatable: falsehere, and file a separate bug report to address that.Comment #13
yesct commentedside note I should open an issue about:
I think that translatable property should be renamed to supportsTranslation (and method isTranslatable() to supportsTranslation() ) for the field definitions.
and we keep translatable and isTranslatable() for the instances.
------
Seems to me that via the UI:
creating, for example, an image file field,
1) that that field definition is translatable true (supportsTranslation), because ... image file fields by default are/do. (and nothing can change whether it supports translation or not)
and
2) that the specific instance of that field created via the UI is initially translatable false, because it has yet not been set to be translatable.
3) but that once the instance *is* set to be translatable, that exporting the config for that instance, should include the fact that it is translatable. (it's translatable in the database)
hmm...
How are other instance settings saved? Like the cardinality, or default value, or allowed values? seems like translatable would be similar
Comment #14
yesct commentedSorry, I think I didn't understand what "instance" meant.
field.instance.comment.comment.comment_body.yml
field.field.comment.comment_body.yml
does have translatable true...
[edit...]
field.instance.node.article.comment.yml
field.field.node.comment.yml
[edit again]
why, though, is
field.instance.node.article.field_image.yml
translatable: true
and field.field.node.field_image.yml
also
translatable: true
?
Comment #15
fran seva commented@YestCT attach the first version of the test.
The test is wrong but the xpath are correct I've checked with chrome console.
Comment #16
gábor hojtsy@fran seva: you are testing fields that are not actually added by the test. The test manually creates the content types and only adds the comment field, not the image field or the tags field. Even if it would add those fields, it would be dynamically added and therefore the test would not test the actual defaults in the standard profile. The fix patches runtime code in the comment.manager, which the test in fact uses to create the comment field, so the test is correct for that in fact, but not for the tags or the image field.
Comment #17
yesct commentedmaybe... @plach is saying that in
./core/profiles/standard/config/install/field.instance.node.article.field_image.yml
it should have a
translatable: false
?
(right now, there is no translatable: ... in there)
Comment #18
yesct commentedSo, /admin/config/regional/content-language
is about content translation, not config translation.
So maybe comment settings should *not* be listed there. (and should not have been *before*), and should be translatable false.
If people want to say that the comments on articles are translatable, then they would use
the comment element to Custom language settings:
For image fields, we dont have title or alt enabled or disabled per language (in core) so we probably shouldn't for comment settings (for content translation).
Config translation would/should probably handle any parts of the comment settings that should be translatable, like the label or the help text.
Comment #19
berdir@YesCT: Comment settings is the *field* that stores the per-node (or other entity) comment settings, meaning, if commenting on that article is open/closed/hidden. This is content.
Making that translatable would mean that it should be possible to for example allow comments on the german original entity but not allow it on the english translation. The qestion is if that actually works, which should be tested. Only if not should it be set to translatable: false in the field because it would not work. But it seems like a useful feature to me.
Comment #21
plach@YesCT:
Please no. We already discussed this extensively in #2143291: Clarify handling of field translatability. We are applying to the
translatableproperty a pattern that is valid for most of the other field properties (except those that cannot be overridden). I don't think special-casing it makes any sense or would be a DX improvement in the long run. Translatable means translatable. There are just different nuances depending on context, but I think that once you grasp the difference between storage field definition and field definition, it becomes immediately clear what thetranslatableproperty means in the two contexts.Comment #22
andypostSo
\Drupal\comment\Plugin\Field\FieldType\CommentItem::__get()should be tuned to properly use default value for translationComment #23
berdirThat shouldn't be necessary, the default value there is not translatable right now afaik, and if it would be, then that would be config translation and just work as you would get the translated config entity.
Comment #24
fran seva commentedAttach the new test to check are presents the followings checkboxes in [1].
I'm not sure about the naming in functions and the class.
[1] /admin/config/regional/content-language
Comment #25
fran seva commentedComment #27
yesct commentedsuper! the test actually fails where we want it to. :)
Talked to @fran seva in irc, and they are going to post an updated test with a rename, and few nit fixes, the interdiff for those changes, and also a combined fix and test patch. :)
Comment #28
fran seva commented@YesCT attach :
- test
- test interdiff
- merge between issue patch and test patch.
Comment #29
fran seva commentedComment #31
fran seva commentedComment #32
fran seva commented@YesCT Change the typo and the array indentation.
I have run phpcodesniffer and there are no error or warnings
Comment #33
fran seva commentedComment #34
yesct commentedI went back and looked at the site config export. I think it is being saved ok, (with the patch) with translatable: true in the right places. (given my new understanding of field.field.... )
Also, I did the manual testing:
the comment setting (open, closed, hidden) *can* be set per language for a node. (except for #2294159: Translations of nodes with comment settings field set to translatable are missing hidden choice). disabling translation on the comment settings, and then re-enabling it: each translation remembers its old setting. which was nice.
Taking off the needs test tag, as we had the 3 fails without the fix, and with the fix and test, we have all passes. So I think that is ok.
Updated issue summary
Next here: a (final-ish) review.
Comment #35
yesct commentedissue summary html fix
Comment #36
plachTechnically speaking I think we could just remove this line as TRUE is the default, but making that explicit won't hurt :)
Good work, thanks!
Comment #37
gábor hojtsyThe bug is a major issue. The fix is simple.
Comment #38
webchickGreat work, folks! Nice to have test coverage for this.
Committed and pushed to 8.x. Thanks!
Comment #40
andypostI seriously recommend to turn this back to FALSE because comment thread is not language depended
The follow-up discussion in #2294159: Translations of nodes with comment settings field set to translatable are missing hidden choice
Comment #41
gábor hojtsyThanks all! Let's discuss that in #2294159: Translations of nodes with comment settings field set to translatable are missing hidden choice indeed.