Problem/Motivation

DeepL released the v3 endpoint for its glossary functionality and changed the handling of glossaries. The data structure was changed, so that a single glossary can include multiple dictionaries with a given language combination and its entries.

Further information can be found here: https://github.com/DeepLcom/deepl-php?tab=readme-ov-file#glossaries
By releasing the new endpoint, they also reduced the available glossaries for free users to only 1. This major change can be overcome by having multiple dictionaries within the glossary.

Proposed resolution

  • follow the migration guide and rewrite the exisiting DeeplGlossaryApi methods
  • introduce dictionaries as new entity, which are now part of a multilingual glossary
  • handling for free/ pro accounts
    • free users cannot add more than one glossary
    • pro users can add up to 1000 glossaries
  • update sync functionality to create glossary/ dictionaries
    • free accounts: in case of having multiple glossaries for a given language combinations those should be merged into a single dictionary
    • pro account: multiple glossaries will be synced as usual - but contain a single dictionary with its entries
    • update general creation workflow for glossaries and dictionaries

User interface changes

  • update listing of glossaries and show number of dictionaries within the glossary
  • add listing of dictionaries for a given glossary
  • add simple search functionality within a dictionary

Data model changes

  • deprecate existing entity type deepl_glossary and related functionality
  • introduce new entity type DeeplMultilingualGlossary
  • introduce new entity type DeeplMultilingualGlossaryDictionary
  • add related functionality (forms, views integration, etc..)
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

steffenr created an issue. See original summary.

steffenr’s picture

Assigned: Unassigned » steffenr
steffenr’s picture

Title: Migrate v2 glossary API to v3 » Update glossary handling to match new MultilingualGlossary structure introduced by DeepL
Version: 2.3.x-dev » 2.2.x-dev
Issue summary: View changes

steffenr changed the visibility of the branch 3522010-migrate-v2-to-v3-glossary to hidden.

steffenr’s picture

Issue summary: View changes
steffenr’s picture

Priority: Normal » Major
steffenr’s picture

Issue summary: View changes
steffenr’s picture

Issue summary: View changes

steffenr’s picture

Issue summary: View changes
steffenr’s picture

Issue summary: View changes
steffenr’s picture

Title: Update glossary handling to match new MultilingualGlossary structure introduced by DeepL » Update glossary handling to match new multilingual glossary/ dictionary structure introduced by DeepL
steffenr’s picture

  • steffenr committed 68fd3707 on 2.2.x
    Issue #3522010: Update glossary handling to match new multilingual...

  • steffenr committed 23c921c7 on 2.2.x
    Issue #3522010: fix php code quality issues
    
steffenr’s picture

Status: Active » Fixed
sachit.thapa’s picture

I updated the module to the 2.2.12 and also ran the batch update. The existing glossaries were deleted from the site but i can still accees the results via API in postmain using both v2 and v3 endpoints. But when i try to Fetch DeepL glossaries i get the following error:

AssertionError: assert(is_string($glossary_id)) in assert() (line 119 of modules/contrib/tmgmt_deepl/modules/tmgmt_deepl_glossary/src/DeeplMultilingualGlossaryApiBatch.php).
Drupal\tmgmt_deepl_glossary\DeeplMultilingualGlossaryApiBatch::syncGlossariesFinishedCallback(1, Array, Array, '2 sec') (Line: 458)
_batch_finished() (Line: 100)
_batch_page(Object) (Line: 52)
Drupal\system\Controller\BatchController->batchPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19) 

Could you please take a look at it? Thanks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

levmyshkin’s picture

StatusFileSize
new1.28 KB

I don't have DeepL Free glossaries, so I added a validation for existing $glossary_id.