wv_deepltranslate icon indicating copy to clipboard operation
wv_deepltranslate copied to clipboard

[FEATURE] Add event or other mechanism to add own glossary

Open sypets opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe.

Current solution does not make it possible to use already existing glossary, which was uploaded to DeepL

Describe the solution you'd like

e.g. DeeplService::translateRequest

 $glossaryId = '';
 // If the source language is set to Autodetect, no glossary can be detected.
 if ($sourceLanguage === 'auto') {
    $sourceLanguage = null;
} else {
            + // <<< emit event here
            + // dispatch new FetchGlossaryEvent($sourceLanguage, $targetLanguage);
            + $glossaryId = $fetchGlossaryEvent->getGlossaryId($sourceLanguage, $targetLanguage);
            + if ($glossaryId === '') {
                // @todo Make glossary findable by current site.
                $glossary = $this->glossaryRepository->getGlossaryBySourceAndTarget(
                    $sourceLanguage,
                    $targetLanguage,
                    DeeplBackendUtility::detectCurrentPage()
                );
                if ($glossary['glossary_id'] !== '') {
                    $glossaryId = $glossary['glossary_id'];
                }
            }
        }

Describe alternatives you've considered

I don't know if this fits conceptually. I think it might make the solution more flexible. Alternatively, there are other TYPO3 extensions I could take a look at.

sypets avatar Jun 24 '24 06:06 sypets

HI @sypets Please take a look in latest version and this Event. I hope, this will help you

https://github.com/web-vision/deepltranslate-core/blob/main/Classes/Event/DeepLGlossaryIdEvent.php

calien666 avatar Dec 20 '24 14:12 calien666

As discussed on Slack: here’s an sample export from the glossary which was created using the DeepL web client.

glossary_excerpt.csv

imminger avatar Jul 24 '25 08:07 imminger