Explanation for strict and flexible modes
Translation DeepL is controlled by language code (ISO-639-1 alpha2, possibly extended by country variant ISO-3166-1 alpha2). The integration adapts the case and separator (either a dash - or an underlined blank _). We also convert codes in query parameters to codes accepted by DeepL whenever possible. For example :
if you request a translation into fr_CA (Canadian French), you send DeepL a request for translation into FR (French) because DeepL only recognizes FR and not fr_CA.
Les règles de conversions sont simple :
usually, we just take the language code ( fr for fr_CA)
except for the following target languages
en_GB, which we convert into EN-GB
en_xx and en which we convert to EN-US
pt_BR, which we convert into PT-BR
pt_xx and pt converted to PT-PT
In general, it is preferable to make translation requests specifying only the language, without varying the country (except for the target languages en_GB, en_US, pt_BR and pt_PT, which are managed by DeepL).
When requesting a translation, we check whether the source language (text language to be translated) and target languages (languages to be translated into) are accepted by DeepL. If one of the language codes is not supported, DeepL is not used.
There are two test modes (configurable in motor parameters).
Strict mode: the code parameter of the translation request is directly tested
For example, if you request a translation in fr_CA, since this code is not managed by DeepL, the translation request is not sent to DeepL.
For example, if you request a translation in French, this code is managed by DeepL, so the request is sent to DeepL
A hard rule has been added: for a translation to EN code, we still send the request to DeepL, despite the fact that this code is not supported by DeepL, converting it to EN-US, as it is common practice to manage the English language using the en code, without varying the country.
Flexible mode: the code in parameter to the translation request is first converted before being tested
For example, if you request a translation in fr_CA, this code is converted to FR, the code supported by DeepL, and the request is therefore routed through DeepL (even though it doesn't support fr_CA)..
For example, if you request a translation in en_NZ (New Zealand English), the code is converted to EN-US (see rules above), so this translation request is still sent to DeepL (although DeepL does not support New Zealand English).
This means that if the customer wishes to differentiate between two language shades depending on the country (e.g. fr_CA and fr_FR), the strict mode must be used for translations into fr_CA that do not go through DeepL, because in flexible mode, a translation request into Canadian French will result in a translation into common French.