Make ConfigEntityBase::language() match the behavior of EntityNG::language()

Created on 28 September 2013, over 11 years ago
Updated 11 February 2025, 3 months ago

Updated: Comment #0

Problem/Motivation

\Drupal\Core\TypedData\TranslatableInterface::language() says:

Returns the default language.

But what does default mean?

\Drupal\Core\Entity\EntityNG returns the language of the currently active language. In terms of code:

$entity_ng->getTranslation('xx')->language()->id == 'xx';

\Drupal\Core\Config\Entity\ConfigEntityBase returns the langcode key of the configuration entity, which is always the langcode of the original, untranslated language. In terms of code:

$context->set('locale.language', new Language(array('id' => 'xx')));
$config_entity->language()->id == 'en';

Proposed resolution

Make this consistent. The current behavior of EntityNG is the saner one, so we should adapt ConfigEntityBase accordingly. Also, the documentation of the TranslationInterface::language() should be updated. It is not very helpful currently.

API changes

ConfigEntityBase::language() returns the language that matches the current locale override.

Related Issues

https://drupal.org/node/2004244β€Ž

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

configuration entity system

Created by

πŸ‡©πŸ‡ͺGermany tstoeckler Essen, Germany

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. 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!

  • Status changed to Closed: outdated about 12 hours ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Since there has been no follow up in 3 months, going to close out. But if still a valid task then it can be re-opened

    Thanks!

Production build 0.71.5 2024