Translation job has no glossary_id setting

Created on 14 August 2024, 3 months ago
Updated 28 August 2024, 3 months ago

Problem/Motivation

Submitting a translation job to deepl fails with the error:

AssertionError: Cannot load the "deepl_glossary" entity with NULL ID. in assert() (Zeile 261 in docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php).

A backtrace is attached.

The TMGMT Job does not have a setting with name "glossary_id", which fails at tmgmt_deepl_glossary.module at line 87.
Because, the setting does not exist, the check for $job->getSetting('glossary_id') returns NULL but for an empty string is checked.

function tmgmt_deepl_glossary_tmgmt_deepl_query_string_alter(Job $job, string &$query_string, array $query_params): void {
  // Add glossary_id based on job settings.
  if ($job->getSetting('glossary_id') !== '') {
    $glossary = Drupal::entityTypeManager()->getStorage('deepl_glossary')->load($job->getSetting('glossary_id'));
    

Steps to reproduce

Configure the deepL plugin, enable the glossary submodule and sync a glossary.
Try submitting a translation job to deepl with the synced glossary language.
The batch fails and the provided error message is logged at the dblog.

🐛 Bug report
Status

Fixed

Version

2.2

Component

tmgmt_deepl_glossary

Created by

🇩🇪Germany J-Lee 🇩🇪🇪🇺

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024