Error on adding new translation

Created on 2 March 2023, almost 2 years ago
Updated 25 September 2023, about 1 year ago

Problem/Motivation

Error on adding new translation, In my case adding an Arabic translation i had this error:
Drupal\Core\Entity\EntityStorageException: Invalid translation language (ar) specified. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 815 of /opt/drupal/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Steps to reproduce

- Add new translation for a given content
- when saving the content an error message is displayed,
- in the Message log the error seems to be: "Error on adding new translation, In my case adding an Arabic translation i had this error:
Drupal\Core\Entity\EntityStorageException: Invalid translation language (ar) specified. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 815 of "

Proposed resolution

using the patch: https://www.drupal.org/files/issues/2023-02-17/estimated_read_time-33229...
then In the /modules/contrib/estimated_read_time/estimated_read_time.module I added a condition in the estimated_read_time_entity_presave() hook to escape the pr-save for the newTranslation
Line : 37 -> if ($entity->isNew() || $entity->isNewTranslation()) {}

I will update the patch to fix this issue

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇨🇦Canada SamirMtl

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024