Rendering: Explicitly contextualize variation context for language fallback (closes #20350) #20587
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prerequisites
If there's an existing issue for this PR then this fixes #20350
Description
This PR addresses a regression for rendering block editor properties using language fallback under certain circumstances.
The essence is: If element types are set to vary by culture, and the containing block editor property also varies by culture, language fallback does not work. See the linked issue for additional details.
The root cause of this regression is that we do not contextualize the current rendering when performing language fallback. This means that the property value converters will continue to resolve the current rendering context as being for the requested language, rather than the active fallback language.
Following an internal discussion, we have deemed this to be wrongful behavior. This PR therefore explicitly contextualizes the fallback language (culture) before attempting to get a value for the fallback language, and reverts the contextualization after the value has been retrieved.
Testing this PR
Using the template below, verify that fallback works for the second language.
Now fill out values in the second language, republish the document, and verify that no fallback is performed.
Template for testing