Problem/Motivation
The default values of text fields do not use the text_format
schema type which was introduced in #2144413: Config translation does not support text elements with a format. This means that the default value of text fields can not be properly translated currently.
Note that this is not only a UX problem (i.e. no CKEditor for translators) but can also lead to security problems.
Proposed resolution
Use the text_format
schema type where appropriate.
The text_with_summary
field type has a slightly different structure (i.e. it has an additional summary
key) so a dedicated schema type is introduced for that. In order to leverage that, a dedicated Config Translation form element is added, to allow that to be translated. Note that this could be split off and handled in a follow-up.
Remaining tasks
User interface changes
Default values of text fields can be translated using a text editor.
API changes
The schema structure of text fields changes (specifically of the default value declaration). Note that the config structure itself does not change!
Beta phase evaluation
Issue category | Bug because default values of text fields cannot be translated with the Config Translation module without this |
---|---|
Issue priority | Normal |
Unfrozen changes | Not unfrozen |
Prioritized changes | The main goal of this issue is usability and security. |
Disruption | Because the actual config structure does not change I cannot possibly fathom whom this would "disrupt". Because the configuration schema structure changes, it is an API change, however, strictly speaking. |
Comment | File | Size | Author |
---|---|---|---|
#56 | Translations for TextWithSummary.png | 29.79 KB | quietone |
#4 | config-translation-text-with-summary.png | 61.3 KB | tstoeckler |
Issue fork drupal-2381147
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #1
tstoecklerI'm actually working on this. If I haven't managed to post a patch in ~3 days or something feel free to take this over.
Comment #2
tstoecklerComment #3
Gábor HojtsyChanges config schema, so D8 upgrade path tag should be on.
Comment #4
tstoecklerHere we go.
Some problems:
text
field type (only thetext_long
andtext_with_summary
types) due to #2348459: Fields of type 'Text (formatted)' do NOT save values..See also the attached screenshot for some context:
Re #3: How specifically is this related to the upgrade path, I don't understand that?
Edit: Duplicate post
Comment #5
Gábor HojtsyOk this does not actually change the config data structure like #2144505: Views does not use the text format type for formatted text, so this does not need the D8 upgrade path tag. I assumed it will change the data structure, but looks like it does not.
Comment #6
Gábor Hojtsy#2348459: Fields of type 'Text (formatted)' do NOT save values. landed. Should be possible to write tests for this now?
Comment #7
Gábor Hojtsy#2144505: Views does not use the text format type for formatted text also landed. Yay!
Comment #8
Gábor Hojtsy@tstoeckler: still working in this one or should we look for someone else to finish?
Comment #9
Gábor HojtsyUnfortunately not being actively worked on so removing from sprint.
Comment #13
AnybodyI can confirm this issue still exists.
Comment #16
tstoecklerFirst a re-roll.
Comment #17
tstoecklerThe previous run was green, even though it never reported back.
Now adding a test. The tests-only patch is also the interdiff.
Unassigning as I'm not sure, when I'll get back to this.
Comment #18
tstoecklerOops sorry. Completely wrong patch files.
Comment #27
smustgrave CreditAttribution: smustgrave at Mobomo commentedComment #28
AkashKumar07 CreditAttribution: AkashKumar07 at TO THE NEW commentedReroll added for patch #18.
Comment #29
smustgrave CreditAttribution: smustgrave at Mobomo commentedpatch failed
Comment #30
smustgrave CreditAttribution: smustgrave at Mobomo commentedComment #32
smustgrave CreditAttribution: smustgrave at Mobomo commentedOkay I found the issue. The patch in #28 removed changes from #18 and I didn't notice that in my attempt at #30.
For the committer please update credit to match.
Rerolled #18 correctly.
Attempted to create an interdiff but got
1 out of 2 hunks FAILED -- saving rejects to file /var/folders/z8/ym9ls3bj01x19hd8xfvsyk_40000gn/T//interdiff-1.FQffex.rej
interdiff: Error applying patch1 to reconstructed file
Comment #34
smustgrave CreditAttribution: smustgrave at Mobomo commentedComment #35
gaurav-mathur CreditAttribution: gaurav-mathur at Dotsquares Ltd. commentedComment #36
gaurav-mathur CreditAttribution: gaurav-mathur at Dotsquares Ltd. commentedHi I've tested this patch #34 on drupal 10.1.x and it works.
Comment #37
jungleFirst, posting the raw interdiff content of 0 bytes
interdiff-32-33.txt
Comment #38
jungle2. review the schema changes
Posting the schema of text_format from
core/config/schema/core.data_types.schema.yml
form_element_class
key which is good, seehook_config_schema_info_alter
belowComment #39
penyaskitoShould we respect the order here? I'm not sure if it's relevant in this case, but could hide bugs.
PHP arrays addition is not commutative (A+B != B+A).
I don't see why those css classes are needed now and not before, but being fair I didn't really test it.
This is great!
Comment #40
jungleAs it's being set back to NW, here should start with 'Tests', #3133162: Replace the start verb Test with Tests in method comments of tests
I've been trying to test it manually, but I can not get the same result as the test. Leaving this issue temporarily
Comment #41
Wim LeersWhile we're making this consistent, we should move the
text_format
type out ofcore.data_types.schema.yml
and into this file.Let's move this class into the
text
module too while we're at it?Comment #44
smustgrave CreditAttribution: smustgrave at Mobomo commentedSorry for taking so long to get back to this.
#39
that I'm not 100% about, may need a bigger brain then my own
Edit: As far as the classes go I believe they were copied from StringTextareWidget.php
#40 fixed
#41.1 moved
#41.2 moved
Moved to MR so hiding patches
Comment #45
smustgrave CreditAttribution: smustgrave at Mobomo commentedReverted #41.1 as it caused some failures and may want to handle in a follow up.
Comment #46
borisson_I agree we don't need to do #41.1 in this issue, it can be a followup for later. Can we file that already as a seperate issue? Otherwise this looks good to go imho.
Comment #47
longwaveTagging so we don't forget #41.
Comment #48
penyaskitoCreated #3395923: Move TextFormat form element from config_translation to text module
Created #3395927: Move text_format data type from core to text module
I think they are independent of each other. Removing "needs followup" tag.
Comment #49
longwaveComment #50
smustgrave CreditAttribution: smustgrave at Mobomo commentedReverted the move.
Comment #51
penyaskitoWe have split the bits that require BC layer into follow-ups. The fix itself was RTBC before, and I think it is, so setting it back to RTBC.
Comment #52
quietone CreditAttribution: quietone at PreviousNext commentedI'm triaging RTBC issues. I read the IS and the comments. I didn't find any unanswered questions or other work to do.
The diff does not apply to 11.x, there setting to NW for a rebase.
This may need a CR with a screenshot informing the user of this new capability.
Comment #54
ankithashettyRebased done, hence moving to NR.
Still need a update on CR as requested in #52.
Thanks!
Comment #55
smustgrave CreditAttribution: smustgrave at Mobomo commentedRestoring status after reroll.
Comment #56
quietone CreditAttribution: quietone at PreviousNext commentedAlways nice to see an old issue getting attention, thanks!
Comment #53 states that this is in need of a CR, therefor setting back to needs work.
To learn more about what this is fixing I tested on Drupal 11.x today, standard install, with a second language and a Textwithsummary field. I was able to translate the default value field without the patch here. Yet, the issue summary states that this change is to allow, "Default values of text fields can be translated using a text editor." Am I missing something? I don't work with translations so maybe I am.
I applied that patch and the translation modal was changed so that both the english default value and the translation default value can be edited. I don't think that it correct, only the translation should be editable. In fact the title is "Edit Italian translation for TextWithSummary" so it should only be for the Italian version.
It is not clear to me what is being fixed here. Tagging for an issue summary update. And since this is changing the UI it should have links to up to date before/after screenshots in the issue summary.
Looking back at the comments I do not see any manual testing. I am adding a tag for that.