Currently in order to retrieve the default language / language code we have to first retrieve the default entity translation object, but this is actually unnecessary as we have the information about the default translation on each entity translaton object under the property $defaultLangcode so it makes to provide direct access to it.
As of now to retrieve the default language and language code we have to do :
$entity->getUntranslated()->language();
$entity->getUntranslated()->language()->getId();
But this way we are going to initialize unnecessary a new entity translation object if there isn't an existing one in the entity translation object cache.
For performance reasons it makes sense to have a direct access to the default language without having to initialize the entity default translation.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 2839132-3.patch | 15.78 KB | hchonov |
Comments
Comment #2
hchonovComment #3
hchonovComment #18
smustgrave commentedThank you for sharing your idea for improving Drupal.
We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #20
smustgrave commentedSince there's been no follow up and a feature request going to close out if still a desired feature please re-open.
Thanks! I did give credit for the initial patch.