Don't add translation, if exist

Created on 14 October 2020, over 4 years ago
Updated 4 January 2024, over 1 year ago

Problem/Motivation

Test entity import cause the following error:

In ContentEntityBase.php line 955:
Invalid translation language (de) specified.

Steps to reproduce

Import test entity (content/media/36eeb2eb-2ac7-491c-852f-41a26ea9eba6.yml):

_meta:
  version: '1.0'
  entity_type: media
  uuid: 36eeb2eb-2ac7-491c-852f-41a26ea9eba6
  bundle: image
  default_langcode: hu
  depends:
    9f3e01ff-944d-41a6-85a2-0d5075ad7874: file
default:
  status:
    -
      value: true
  uid:
    -
      target_id: 1
  name:
    -
      value: hotel-foobar-logo.jpg
  created:
    -
      value: 1602172749
  revision_translation_affected:
    -
      value: true
  content_translation_source:
    -
      value: und
  content_translation_outdated:
    -
      value: false
  field_media_image:
    -
      entity: 9f3e01ff-944d-41a6-85a2-0d5075ad7874
      alt: 'A Hotel Foobar emblémája'
      title: ''
      width: 557
      height: 545
translations:
  de:
    status:
      -
        value: true
    name:
      -
        value: hotel-foobar-logo.jpg
    revision_translation_affected:
      -
        value: true
    content_translation_source:
      -
        value: und
    content_translation_outdated:
      -
        value: false
    field_media_image:
      -
        entity: 9f3e01ff-944d-41a6-85a2-0d5075ad7874
        alt: 'Hotel Foobar Logo'
        title: ''
        width: 557
        height: 545
  en:
    status:
      -
        value: true
    name:
      -
        value: hotel-foobar-logo.jpg
    revision_translation_affected:
      -
        value: true
    content_translation_source:
      -
        value: und
    content_translation_outdated:
      -
        value: false
    field_media_image:
      -
        entity: 9f3e01ff-944d-41a6-85a2-0d5075ad7874
        alt: 'Hotel Foobar logo'
        title: ''
        width: 557
        height: 545
🐛 Bug report
Status

Postponed

Version

2.0

Component

Code

Created by

🇭🇺Hungary nevergone Nyíregyháza, Hungary, Europe

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

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