InvalidArgumentException: Invalid translation language specified.

Created on 17 November 2013, about 11 years ago
Updated 17 February 2023, almost 2 years ago

Problem/Motivation

This error occurred when adding an English translation of a German article (node/2/translations/add/de/en):

InvalidArgumentException: Invalid translation language (en) specified. in Drupal\Core\Entity\ContentEntityBase->addTranslation() (line 691 of core\lib\Drupal\Core\Entity\ContentEntityBase.php).

Steps to reproduce

  1. Install using standard profile in English
  2. Log in as a user with "translate any entity" permission - user 1 will do
  3. Create an English article node
  4. Install Content Translation module
  5. Add German language
  6. Enable content translation for article nodes with the default settings
  7. Go to de/node/1/translations/add/en/de and add a translation
  8. Go back to de/node/1/translations/add/en/de
  9. You will get a fatal error

or

  1. Go to content admin and use the filters to find the node I want to translate. Click its Translation operation link.
  2. Add a French translation and save it. This takes me back to the content admin page.
  3. Wait, I forgot to change something! But I can't see my node any more as it's not in the first page of results. I know, I'll just press Back and that'll get me back to the form I was just at, right?
  4. BOOM.

Note there may be other ways to reproduce this such as unchecking Create new revision in the node and translation.

Proposed resolution

Redirect to the latest translation?
or something else

Remaining tasks

  1. Decide on where to send the user
  2. Review
  3. Commit

User interface changes

API changes

🐛 Bug report
Status

Needs work

Version

10.1

Component
Language module 

Last updated about 6 hours ago

  • Maintained by
  • 🇩🇪Germany @sun
Created by

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.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

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

Production build 0.71.5 2024