Problem/Motivation
When translating an entity which has non-translatable fields, those may be hidden from translation forms or marked as (*all translations), so the user is aware that he is editing all the translations.
That's not the case for the properties in fields which allows to configure at the property level (which only case in Drupal core right now is image fields).
The attached screenshot may show this in a clear way:

I'm tagging this with Usability, and categorizing it as Bug report, but may be considered a feature request.
Also not sure if the field system component is the right one yet.
Proposed resolution
Add a mark when editing a field property will affect all the translations as we do with fields themselves.
After discussing this with Gábor, looks like this only can be done at the widget level, so maybe that's not automagically added as with fields per field property.
If that's the case, let's do that for the widgets in core for images.
Remaining tasks
Add patch with tests.
User interface changes
A mark is added if a subfield will affect all translations.
API changes
TBD
Data model changes
TBD
Release notes snippet
TBD
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | interdiff_32-33.txt | 807 bytes | pradhumanjain2311 |
| #33 | 3152587-33.patch | 11.74 KB | pradhumanjain2311 |
| #32 | interdiff_24-32.txt | 5.85 KB | ravi.shankar |
| #32 | 3152587-32.patch | 11.75 KB | ravi.shankar |
| #24 | 3152587-24.patch | 11.64 KB | awset |
Comments
Comment #2
penyaskitoDiscussed this with @GáborHojtsy and he pointed out that this couldn't be done without some intervention from the widget themselves.
The cleaner way I can think of is that the different widgets mark which FAPI elements are related to which columns, so we can then use that for adding the translatability cue.
Attached patch adds this functionality, and provides the valid "meta" for the image widget so we can do this for images. It's not complete, but would like some feedback on if this would be acceptable in core.
Attaching some screenshots of the settings and how the form would look like.
Comment #3
penyaskitoUpdated also the patch at #3152582: [PP-1] Allow translation of individual Link subfields as it would work as an even more simple example.
Comment #5
penyaskitoI think this should fix it.
Comment #6
andypostComment #11
smustgrave commentedClosed https://www.drupal.org/node/2582479 as a duplicate of this.
If credit can be moved over for.
peterarnold
jhodgdon
.
Comment #14
quietone commented@smustgrave, thanks. I looked at the other issue as well. Adding credit.
Comment #15
quietone commentedTagging because this was looked at as part of triaging the closed duplicate.
Comment #16
awset commentedhi All,
I have re-rolled the patch so it works on the 9.5 branch,
added reroll patch as well
I also conducted a test with the below steps
below is the result.
it seems the patch is working fine, need another eye to review the latest patch.
thanks
Comment #17
awset commentedfixing the command failed.
Comment #18
Manibharathi E R commentedPatch #17 tested and Applied successfully on Drupal 9.5.x.
Before Patch:

After Patch:

Comment #19
smustgrave commentedNot sure all the screenshots are needed.
But can we get a tests-only patch and the full patch to verify a fail/pass.
Did not do a code review.
Comment #20
ameymudras commented@awset thanks for your work on this issue. I have a few suggestion related to the code here
1. May be can combine the two if statements into a single one
2. We should be avoiding \Drupal calls within a class, we should be using dependency injection wherever possible
3. Since $form_object is not getting utilised again in the code we can reduce
to
$entity = $form_state->getFormObject()->getEntity();Comment #21
smustgrave commentedAddressed issues in #20
But this still needs tests
Comment #22
penyaskitoThis can't be included before 10.1.x at this point per @GáborHojtsy and @longwave comments on Slack, so changing target version accordingly.
Comment #23
awset commentedComment #24
awset commentedHello, awesome ppl.
I have created a test-only patch and the test script as well, interdiff is attached too.
need review.
thanks.
Comment #25
awset commentedit seems there is an unrelated error on the test.
Comment #26
awset commentedthe unrelated issue seems already fix it, need review.
Comment #27
ameymudras commentedTested on Drupal 10.1.x and php 8.1
- The patch applies cleanly
- Issue summary is clear and explains the problem
- Test is included and test only patch is provided
- Couldn't identify any issues with the code
- Patch fixes the issue.
Not including the before / after screenshots here to avoid duplicates. Marking this issue RTBC
Comment #28
alexpottWe adding a new dependency we need set the default value to NULL and then trigger a deprecation notice if it is NULL and get the value from \Drupal::service().
This should link to an issue on drupal.org... also what happens if this list is wrong.
I think we should do an early return here since we don't do anything if this is false...
ie.
This is never set to TRUE.
The first sentence here seems to imply we're going to hide something. I can't see where and if that actually happens.
I think this code can be removed. $display_warning is never set to TRUE.
This method should have a comment saying what is being tested.
This addition to the Field Widget API needs documentation somewhere. And would need a change record.
Comment #29
catchReading the issue summary I was expecting all the logic to be in the field widget, and to be honest I think requiring the field widgets to handle this seems like a better approach than trying to do it semi-magically, especially given there are changes needed in the image widget anyway.
Comment #30
berdirDidn't review yet, just a note that widgets like paragraphs tend to require special handling for stuff like this, also needed it for the existing message and we'll need to make sure that is possible. Will review after vacation
Comment #31
gábor hojtsy@catch asked me to take a look as well. I agree the field widget may use any way to display text, it could be in twig templates, JS, etc. We can's just assume that manipulating the render array will work with arbitrary widgets IMHO.
Comment #32
ravi.shankar commentedI've tried to fix the below points from comment #28 please review.
1. Added deprecation notice, added @see the tag as the current issue.
3. Added early return.
4. Removed variable $display_warning.
5. Removed unrelated comments.
6. Removed unnecessary code.
7. Added description for method.
Keeping the status to needs work for point number 2 and 8 of comment #28.
Comment #33
pradhumanjain2311 commentedTry to fix CS errors.