Allow use of glossaries for translations

Created on 9 September 2021, over 3 years ago
Updated 27 November 2023, over 1 year ago

Problem/Motivation

  • deepL introduced the possibility to use a custom glossary while translating text and documents

Proposed resolution

  • Allow creation of custom glossaries via deepL API in drupal
  • Add config / option to specify glossary id in tmgmt_deepl UI
  • Pass glossary_id in API calls while requesting translatinos

User interface changes

  • Add select field for selecting glossary on the translator config form
  • Administration page for glossaries
Feature request
Status

Fixed

Version

2.2

Component

Code

Created by

🇩🇪Germany SteffenR Germany

Live updates comments and jobs are added and updated live.
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.

  • 🇩🇪Germany vistree

    Hi SteffenR - nice work!!! Is there any release plan? Is there a way to support with testing, ...?

  • 🇩🇪Germany SteffenR Germany

    @vistree
    We don't have a release plan for the feature, since most of the development is happening besides our main projects.
    But the current MR can be tested.
    Feel free to do so and add comments in this issue.

    Short instructions for testing:

    • install tmgmt_deepl and configure the free and/ or pro endpoint with your API key
    • install tmgmt_deepl_glossary
      • a new section DeepL Glossaries will be available at admin/tmgmt
      • start adding new glossaries at /admin/tmgmt/deepl_glossaries
      • create new translations via default tmgmt workflow - in case glossary is existing for source -> target language it will be used in your translation
      • if you have multiple glossaries for source -> target language combination, you can select between those glossaries (option needs to be set in tmgmt translator settings

    There is still need for some unit tests and polishing of error messages, but the main functionality is working.

  • 🇩🇪Germany vistree

    Hi SteffenR,
    really nice work!! Thank you!!!
    One question: we want to use deepl with glossaries in multiple project: is it somehow possible to uninstall the module without deleting the glossary on deepl backend? So, remove only in Drupal - but let it stay on deepl?

  • 🇩🇪Germany SteffenR Germany

    @vistree
    Currently this is not possible, because deleting a glossary would result in an API Call, which also deletes the glossary on deepL to keep things consistent.
    If you have multiple sites, which should use the same glossary, you can run into some problems due to the API.

    • glossary entries cannot be edited directly via the API - instead, we have to do a delete/ add operation -> leads to new glossary_ids with every change
    • need of a cron to synchronize glossaries, instead of manual action on the glossary overview page
    • not deleting would lead to obsolete glossaries on API site (we cannot delete those via any UI besides the module)

    Since the glossary is directly tied to the deepL API token (free or paid), you can create one glossary per project and use it standalone.

    Another approach for sharing multiple glossaries would be a "main site", were the glossaries can be edited/ administered for all projects. But for this approach the module needs some additional features like:

    • more granular permissions for deleting/ editing glossaries
    • cron for automatic synchronisation of glossaries
  • Status changed to Needs review almost 2 years ago
  • 🇩🇪Germany SteffenR Germany

    I set this issue to "Needs review" to get some feedback from the community.
    Please play around with the feature and leave comments in the issue for getting a 2.2.0 release.

  • 🇫🇷France duaelfr Montpellier, France

    I'll have to implement that in the next months. I'll provide feedback as soon as it's coming to my prioritary todo list.
    Thank you for implementing that!

  • 🇩🇪Germany SteffenR Germany

    @DuaelFr: I justed wanted to ask, if everything went fine, while implementing the feature?

  • 🇩🇪Germany mrshowerman Munich

    @SteffenR, thanks very much once more for the great work on the glossary integration.
    We started to use the new submodule, and it's working nicely. I was also suprised that we're now able to keep the "quick checkout" setting active, much appreciated!

    I'd like to give feedback on one thing that came to my mind:

    In order to enable editors to add, edit and delete glossary entries, it seems like not only the appropriate permissions are needed, but also the Administer DeepL glossary entities, otherwise they don't see the menu item. We might want to change this, so editors are able to edit glossary entries while not being permitted to edit the glossary entity itself.

  • 🇩🇪Germany SteffenR Germany

    @mrshowerman: Further work on this topic should be covered within a new issue. May you check the Proposed resolution there and comment in case i'm missing sth..
    Thx.

  • 🇩🇪Germany mrshowerman Munich

    Left a comment in the related issue.

    I also noticed a few wording issues concerning the new glossary functionality. Since this issue is still in status Needs Review, should I leave comments here, or do you prefer a separate issue, @SteffenR?

  • 🇩🇪Germany SteffenR Germany

    Yep. Just leave a comment in here. I'll take care of those issues. Thx.

  • 🇩🇪Germany mrshowerman Munich

    Ok, here we go:

    • In modules/tmgmt_deepl_glossary/src/Entity/DeeplGlossary.php, line 147:
      // The entries of of the glossary.
      

      => Duplicate "of". Same in line 151 of the same file, and also in modules/tmgmt_deepl_glossary/src/DeeplGlossaryApiBatchInterface.php (line 32) and modules/tmgmt_deepl_glossary/src/DeeplGlossaryApiInterface.php (line 57).

    • There are the terms "DeepL glossary" and "DeepL Glossary" (also in plural form), we might want to use only one of the two forms.
    • Similarly, we're mixing the terms "Glossary Id" and "DeepL glossary Id".
    • In modules/tmgmt_deepl_glossary/tmgmt_deepl_glossary.module, line 74:
          '#description' => t('By default it is possible to create one glossary for a source/ target language combination and the matching glossary will be selected automatically in the translation workflow. This will also enable selection of glossaries in the checkout form of translation job.'),
      

      This text is hard to read. What about this:

          '#description' => t('By default, it is possible to create only one glossary per source/target language combination, and the matching glossary will be selected automatically in the translation workflow. This setting will also enable selection of glossaries in the checkout form of a translation job.'),
      
    • In modules/tmgmt_deepl_glossary/tmgmt_deepl_glossary.permissions.yml, line 2:
      delete deepl_glossary entities:
        title: Delete DeepL glossary entities.
      

      => Either remove the trailing dot, or add it to the other permission titles as well.

    • In modules/tmgmt_deepl_glossary/src/Form/DeeplGlossarySyncForm.php, line 57:
          return $this->t('Sync deepL glossaries');
      

      Should be

          return $this->t('Sync DeepL glossaries');
      

      Same applies to lines 64 and 71.

    • Similar issue in modules/tmgmt_deepl_glossary/config/install/views.view.tmgmt_deepl_glossary.yml, lines 9 and 440.
  • Assigned to SteffenR
  • Status changed to Active over 1 year ago
    • SteffenR committed 3a90dcd8 on 2.2.x
      #3232134: fix phpstan/ phpcs issues in tmgmt_deepl_glossary submodule
      
    • SteffenR committed a80c4341 on 2.2.x
      #3232134: update title of permissions - set title in single quotes and...
    • SteffenR committed ab62170c on 2.2.x
      #3232134: fix typo in DeeplGlossaryListBuilder - title for glossary_id...
    • SteffenR committed c117f162 on 2.2.x
      #3232134: fix typos - use "DeepL glossary" instead of "deepL glossary"
      
  • 🇩🇪Germany SteffenR Germany

    @mrshowerman Thx for the findings. I've changed the code according to your suggestions.
    All occurences of deepL where changed to DeepL (like in their API documentation) and the description text was updated.
    I also run a phpstan/ phpcs test against the tmgmt_deepl_glossary submodule and added some fixes.

    The time was sponsored by my lovely daughter, who is currently at the swimming competition. (Dad taxi 🚕🚕🚕)

  • Status changed to Needs review over 1 year ago
  • Status changed to RTBC over 1 year ago
  • 🇩🇪Germany mrshowerman Munich

    Thanks a lot! Also to your lovely sponsor 🏊‍♀️🏊

  • Status changed to Fixed over 1 year ago
    • SteffenR committed 8ab1dda4 on 2.2.x
      #3232134: improve method getValidSourceTargetLanguageCombinations
      
       - we...
    • SteffenR committed 17f96d15 on 2.2.x
      #3232134: add glossary languages: Portuguese, Russian, Chinese
      
  • Issue was unassigned.
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024