Problem/Motivation

Currently for example the frontpage view shows just nodes of the current language, which is fine, unless you have entities which don't have a defined language, which could for example
happen somehow if people manually create entities via the API.

Proposed resolution

Not only show the current content language entities but also the ones undefined ones.

Remaining tasks

User interface changes

API changes

Comments

Gábor Hojtsy’s picture

Issue tags: +D8MI, +language-content

Entities created with the API should have the default language applied properly as of #1966436: Default *content* entity languages are not set for entities created with the API. The use case of "entities with no language" is very narrow and it is highly unlikely the front page would have such nodes? What's a use case for a node that has no title or other textual field and only has language independent content to show on the front page?

The idea in D8 is all entities (content, config, etc) have a language assigned if at all possible. The use case for entities without a language is limited to cases where it was an explicit choice.

dawehner’s picture

Mh okay, berdir suggested that we have this kind of fallback. I think people might accidentally create these entities so it wouldn't really harm anyone to also show them, wouldn't it?

Gábor Hojtsy’s picture

BTW #2333731: WebTestBase::drupalCreateNode() should not hardcode default values would fix tests so they test the assumed default behaviour instead of opting out of language on nodes in tests.

Gábor Hojtsy’s picture

@dawehner: Crossposted. Unless someone explicitly specifies und, they cannot accidentally create nodes in und. Not even in tests thanks to #2333731: WebTestBase::drupalCreateNode() should not hardcode default values. I don't think its a good solution to make those nodes appear on the front page, that would just postpone figuring out that people did something wrong.

Berdir’s picture

Just because entities are created with en by default doesn't make it is not possible to have it. We have that option in the language selector for a reason?

It makes perfect sense to me to show them on the frontpage. If I check Promoted, then I expect that node to show up there, no matter what language I select. There is no risk for duplicates, as they can not have translations.

Gábor Hojtsy’s picture

@Berdir: apart of "why not" what is the use case for such nodes?

dawehner’s picture

Well the point is that it is an implementation detail that entities are saved as 'en' by default and we should try to not rely on implementation details, unless we have to.
It could easily happen that people actually choose to think that 'en' is not the value they want and booom entities don't appear anymore.

Gábor Hojtsy’s picture

Well the point is that it is an implementation detail that entities are saved as 'en' by default and we should try to not rely on implementation details, unless we have to. It could easily happen that people actually choose to think that 'en' is not the value they want and booom entities don't appear anymore.

Erm, not really. Only configured languages may be results of language negotiation. Only configured languages may be used as translation targets in interface translation. Config and content entities can only be translated ever if they have a configurable language (not und, zxx or any other locked language that may be on the system). In the language system the non-configurable AKA locked languages are the outliers that you would use if you had absolutely no better idea. You may be used to Drupal 7 sites where there are lots of unknown stuff but that was due to bad defaults. I think Drupal has some responsibility to lead people to best practices. One of the great achievements of Drupal 8 is now whatever content knows to the field level its language(s). If users are to create whatever content without language information (which we know would lead to issues down the road when they attempt to export them as a web service, when displaying language metadata in the HTML, when serving them in a feed, when migrating to a multilingual site, etc) then making it appear like its all OK and part of the default behaviour not to stop that out of the gate is IMHO a bad idea.

We want people to assign actual languages to things whether for accessibility (so screen readers know which language reading to use), bots (so machines, your built-in search service, eg. solr knows how to stem, index, etc), and so on. Its not like you decide on a whim to use 'und' for fun and there are no repercussions. If we know the user is going down such a rabbit hole, should we stop it happening as soon as possible?

What's the use case?

Berdir’s picture

Sorry, but I disagree :)

It's not even an implementation detail, it's a configuration option.

It is perfectly valid for some content to not be language specific. We offer this, we even offer to set certain content types to not applicable or not specified by default. Why should we dictate our users to not use those codes?

This won't hurt anyone who isn't using them, the performance impact of a = 'en' vs. a IN ('en', 'und') should be minimal. But there is no reason to force-hide them?

Gábor Hojtsy’s picture

All right. I don't agree with this, but I won't stop it from happening.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.