integreat-cms
integreat-cms copied to clipboard
Add support for deepl glossaries
Short description
This pr adds basic support for deepl glossaries. If enabled, every glossary defined at deepl will be used (undefined behavior if multiple glossaries for the same source to target language pair exist)
For now, the feature is disabled by default. Note to self: Enable the setting on the test server when merged
How to test
- Set
DEEPL_GLOSSARIES_ENABLED
toTrue
in the settings - Configure deepl by setting the integreat deepl password to the free deepl api password from passbolt.
- Translate a page that contains glossary words from german to english
- Check that the english translation uses the corresponding glossary entry
You can print out all available glossary entries with print(self.translator.get_glossary_entries(glossary))
~~Note that at the time where I am writing this the de-en dictionary is accidentally reversed (so when translating from de to en, deepl replaces english words in the source translation with german words in the target translation)~~ This is fixed now
Proposed changes
- Load available glossaries on startup
- Use matching glossary, if it exists
Side effects
None, since the feature is disable by default
Resolved issues
Fixes: #3045