Problem/Motivation

In Deepl, glossaries with the target language EN can be used in translations with both English variants (EN-GB and EN-US). However, this doesn't work in the module: The translation service provider (/admin/tmgmt/translators) must be set to the target language EN for the glossary to be considered.

Steps to reproduce

1. Set the target language for the translation service provider (/admin/tmgmt/translators) to "English (british)"
2. Create a glossary (/admin/tmgmt/deepl_glossaries) and select "English" as the target language. In the Translator field, select your translation provider.
3. Now translate a piece of content with your translation service provider: The glossary is ignored. However, if you set the target language of the translation service provider to "English," the glossary will be considered.

Proposed resolution

I made the following changes to the function "getMatchingGlossaries".

      // 'source_lang' => $source_lang,
      // 'target_lang' => $target_lang,
      'source_lang' => substr($source_lang, 0, 2),
      'target_lang' => substr($target_lang, 0, 2),

That's how it works for me.

Comments

bit-checker created an issue. See original summary.

steffenr’s picture

steffenr’s picture

I've added the related issue, were this behaviour was changed. More info can be found there.

Can you create a Merge Request please, that checks for EN-GB/ EN-US and rewrites the mapping or provides a logic using a array which would allow more than those language codes?

Thanks.

steffenr’s picture

Status: Active » Needs work
steffenr’s picture

Version: 2.2.10 » 2.2.x-dev
Status: Needs work » Fixed

@bit-checker: The issue was fixed in #3521025: Add new languages for glossary source and target languages and is available in the latest 2.2.x branch.

Status: Fixed » Closed (fixed)

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

bit-checker’s picture

After updating to version 2.2.11, the translation into British English and the glossary work perfectly for me.
@steffenr: Thanks for your work!