Currently when we are editing or loading an entity translation we first load the entity in the default translation and then initialize a new entity translation object for the desires translation. This however is unnecessary and for performance and memory reasons we should be loading the entity directly into the desired translaton and have only one instead of two entity objects.
This is actually pretty easy to do and we just have to set the property $activeLangcode in ContentEntityBase to the current content language code if the entity has a translation for it otherwise leave it set to the default language code as it is now. This however will be a really big BC break and in order to avoid it we could for Drupal 8 just introduce a site setting according to which we have the new or the previous behavior and deprecate the setting and in Drupal 9 make the new behavior the default one.
Comment | File | Size | Author |
---|---|---|---|
#5 | interdiff-3-5.txt | 661 bytes | hchonov |
#5 | 2839135-5.patch | 6.45 KB | hchonov |
#3 | 2839135-3.patch | 6.41 KB | hchonov |
Comments
Comment #2
hchonovComment #3
hchonovComment #5
hchonovIf the content language is the same as the default language of the entity then we should not set the language code to $activeLangcode, because in this case it should point to LanguageInterface::LANGCODE_DEFAULT.
Comment #7
ndobromirov CreditAttribution: ndobromirov commentedReflow this