From e07603b2a96a3e113d87b6fac637f75d532e8d71 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Thu, 4 Oct 2018 07:42:32 +0200 Subject: [PATCH] Add proxy --- libse/Translate/MicrosoftTranslator.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/libse/Translate/MicrosoftTranslator.cs b/libse/Translate/MicrosoftTranslator.cs index f48d02d20..c0af76438 100644 --- a/libse/Translate/MicrosoftTranslator.cs +++ b/libse/Translate/MicrosoftTranslator.cs @@ -80,6 +80,7 @@ namespace Nikse.SubtitleEdit.Core.Translate { var url = string.Format(TranslateUrl, sourceLanguage, targetLanguage); var httpWebRequest = (HttpWebRequest)WebRequest.Create(url); + httpWebRequest.Proxy = Utilities.GetProxy(); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "POST"; httpWebRequest.Headers.Add(SecurityHeaderName, _ocpApimSubscriptionKey); @@ -97,16 +98,7 @@ namespace Nikse.SubtitleEdit.Core.Translate { isFirst = false; } - - var t = text; - if (sourceLanguage == "en") - { - t = text.Replace(" don't ", " do not "); - t = text.Replace(" don't ", " do not "); - t = text.Replace(" don't ", " do not "); - } - - jsonBuilder.Append("{ \"Text\":\"" + Json.EncodeJsonText(t) + "\"}"); + jsonBuilder.Append("{ \"Text\":\"" + Json.EncodeJsonText(text) + "\"}"); } jsonBuilder.Append("]"); string json = jsonBuilder.ToString();