Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 299620

InvalidArgumentException: Invalid translation language specified.

$
0
0

Problem/Motivation

Drupal throws a fatal error when trying to add a translation to entity which already has a translation on given language.

Original report:
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 translation overview page.

Remaining tasks

  1. Create patch with test
  2. Decide on where to send the user
  3. Review
  4. Commit

User interface changes

API changes


Viewing all articles
Browse latest Browse all 299620

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>