Setting entity language to an invalid language should throw exception

Created on 27 October 2012, about 12 years ago
Updated 22 March 2024, 9 months ago

Problem/Motivation

When getTranslation is called with the langcode of an invalid language, it throws an exception.

InvalidArgumentException: Unable to get translation for the invalid language 'de'. in Drupal\Core\Entity\EntityNG->getTranslation() (line 230 of /Users/clark/Sites/d8jsonld/core/lib/Drupal/Core/Entity/EntityNG.php).

However, when an entity's default language is set to an invalid language, it does not throw an exception. It simply makes calls to $entity->language() return FALSE.

Proposed resolution

Throw an exception when an entity's default language is set to an invalid language.

πŸ› Bug report
Status

Closed: cannot reproduce

Version

11.0 πŸ”₯

Component
EntityΒ  β†’

Last updated about 16 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States linclark

Live updates comments and jobs are added and updated live.
  • D8MI

    (Drupal 8 Multilingual Initiative) is the tag used by the multilingual initiative to mark core issues (and some contributed module issues). For versions other than Drupal 8, use the i18n (Internationalization) tag on issues which involve or affect multilingual / multinational support. That is preferred over Translation.

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.

  • Status changed to Closed: cannot reproduce 9 months ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    @linclark, Thank you for reporting this problem. We rely on issue reports like this one to resolve bugs and improve Drupal core.

    There has been no confirmation that this still exists in the past 10 years. More information about this issue was asked for in 1 years ago and none has been provided. Therefor closing.

    If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue β†’ (starting from "Install Drupal core").

    Thanks!

Production build 0.71.5 2024