public string Translate(LanguagePair languageDirection, string sourceText)
        {
            _formality = Helpers.IsLanguageCompatible(languageDirection.TargetCulture) ? _formality : Formality.Default;

            var targetLanguage  = GetLanguage(languageDirection.TargetCulture, SupportedTargetLanguages);
            var sourceLanguage  = GetLanguage(languageDirection.SourceCulture, SupportedSourceLanguages);
            var translatedText  = string.Empty;
            var normalizeHelper = new NormalizeSourceTextHelper();

            try
            {
                sourceText = normalizeHelper.NormalizeText(sourceText);

                using (var httpClient = new HttpClient())
                {
                    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

                    httpClient.Timeout = TimeSpan.FromMinutes(5);
                    var content = new StringContent($"text={sourceText}" +
                                                    $"&source_lang={sourceLanguage}" +
                                                    $"&target_lang={targetLanguage}" +
                                                    $"&formality={_formality.ToString().ToLower()}" +
                                                    "&preserve_formatting=1" +
                                                    "&tag_handling=xml" +
                                                    $"&auth_key={ApiKey}",
                                                    Encoding.UTF8, "application/x-www-form-urlencoded");

                    httpClient.DefaultRequestHeaders.Add("Trace-ID", $"SDL Trados Studio 2021 /plugin {_pluginVersion}");

                    var response = httpClient.PostAsync("https://api.deepl.com/v2/translate", content).Result;
                    if (response.IsSuccessStatusCode)
                    {
                        var translationResponse = response.Content?.ReadAsStringAsync().Result;
                        var translatedObject    = JsonConvert.DeserializeObject <TranslationResponse>(translationResponse);

                        if (translatedObject != null && translatedObject.Translations.Any())
                        {
                            translatedText = translatedObject.Translations[0].Text;
                            translatedText = DecodeWhenNeeded(translatedText);
                        }
                    }
                    else
                    {
                        var message =
                            $"HTTP Request to DeepL Translate REST API endpoint failed with status code '{response.StatusCode}'. " +
                            $"Response content: {response.Content?.ReadAsStringAsync().Result}.";
                        _logger.Error(message);
                        throw new HttpRequestException(message);
                    }
                }
            }
            catch (Exception e)
            {
                _logger.Error($"{e.Message}\n {e.StackTrace}");
                throw;
            }

            return(translatedText);
        }
        public string Translate(LanguagePair languageDirection, string sourceText)
        {
            _formality = Helpers.IsLanguageCompatible(languageDirection.TargetCulture) ? _formality : Formality.Default;

            var targetLanguage  = GetLanguage(languageDirection.TargetCulture, SupportedTargetLanguages);
            var sourceLanguage  = GetLanguage(languageDirection.SourceCulture, SupportedSourceLanguages);
            var translatedText  = string.Empty;
            var normalizeHelper = new NormalizeSourceTextHelper();

            try
            {
                sourceText = normalizeHelper.NormalizeText(sourceText);

                var content = new StringContent($"text={sourceText}" +
                                                $"&source_lang={sourceLanguage}" +
                                                $"&target_lang={targetLanguage}" +
                                                $"&formality={_formality.ToString().ToLower()}" +
                                                "&preserve_formatting=1" +
                                                "&tag_handling=xml" +
                                                $"&auth_key={ApiKey}",
                                                Encoding.UTF8, "application/x-www-form-urlencoded");

                var response = DeeplApplicationInitializer.Clinet.PostAsync("https://api.deepl.com/v1/translate", content).Result;
                response.EnsureSuccessStatusCode();

                var translationResponse = response.Content?.ReadAsStringAsync().Result;
                var translatedObject    = JsonConvert.DeserializeObject <TranslationResponse>(translationResponse);

                if (translatedObject != null && translatedObject.Translations.Any())
                {
                    translatedText = translatedObject.Translations[0].Text;
                    translatedText = DecodeWhenNeeded(translatedText);
                }
            }
            catch (AggregateException aEx)
            {
                foreach (var innerEx in aEx.InnerExceptions)
                {
                    _logger.Error(innerEx);
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                throw;
            }

            return(translatedText);
        }