Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: FEATURE: Add glossary management #46

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lorenzulrich
Copy link

This code is extracted from https://github.com/robert-heinig/Sitegeist.LostInTranslation/tree/feature/glossaries. Since this branch diverged heavily from the original package, I extracted all relevant changes to this branch.

This is not meant from merging as code style-wise the feature is not really in line with the rest of LostInTranslation. However, I'm pushing this as a base for discussion if we should bring this to a state that is mergeable.

This can be configured as follows:

Sitegeist:
  LostInTranslation:
    DeepLApi:
      glossary:
        backendModule:
          sortByLanguage: 'DE'
        languagePairs:
          -
            source: 'DE'
            target: 'EN'

This allows adding a glossary when DE is translated to EN. It relies on the deeplLanguage being set in the CR dimension configuration, e.g.:

Neos:
  ContentRepository:
    contentDimensions:
      language:
        label: 'Sprache'
        icon: icon-globe-europe
        default: de_CH
        defaultPreset: de_CH
        presets:
          de_CH:
            label: 'Deutsch'
            values:
              - de_CH
            uriSegment: ''
            options:
              deeplLanguage: 'DE'
          en_GB:
            label: 'English'
            values:
              - en_GB
            uriSegment: 'en'
            options:
              deeplLanguage: 'EN'
              translationStrategy: 'once'

Please be aware of the following:

  • The DeepL glossary API does not allow editing a glossary item (see here). That means that every time the glossary is changed, a new glossary must be pushed to DeepL and the old one deleted. Therefore, you need to execute ./flow flow glossary:sync to set up and sync the glossary (also when installing it).
  • The DeepL glossary apparently is not just a "search & replace" which will lead to unexpected results. Without enough text/context, it is possible that terms are not replaced or not replaced properly. I don't have more insight how it actually works, but found a mention of it here and have experienced the behaviour myself.

Resolves: #5
cc @robert-heinig


[$sourceLangauge, $targetLangauge] = $this->deepLApi->getLanguagesFromInternalGlossaryKey($internalGlossaryKey);
$createData = [
'name' => "Solarwatt Website, source $sourceLangauge, target $targetLangauge",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be uninteded from the original author ;-), needs to be replaced by the Site name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FEATURE: Support glossaries
1 participant