DeepL changed the way to select secondary language (US English and UK English)

This commit is contained in:
Blu3train 2023-04-04 01:32:07 +02:00
parent cb43f0db01
commit da56952c61

View File

@ -162,8 +162,6 @@ std::pair<bool, std::wstring> Translate(const std::wstring& text, TranslationPar
else else
{ {
currTranslateTo = tlp.translateTo; currTranslateTo = tlp.translateTo;
for (int retry = 0; ++retry < 20; Sleep(100))
if (Copy(DevTools::SendRequest("Runtime.evaluate", LR"({"expression":"document.readyState"})")[L"result"][L"value"].String()) == L"complete") break;
DevTools::SendRequest("Page.navigate", FormatString(LR"({"url":"https://www.deepl.com/en/translator#%s/%s/%s"})", (tlp.translateFrom == L"?") ? codes.at(tlp.translateFrom) : codes.at(tlp.translateFrom).substr(0, 2), codes.at(tlp.translateTo), Escape(escaped))); DevTools::SendRequest("Page.navigate", FormatString(LR"({"url":"https://www.deepl.com/en/translator#%s/%s/%s"})", (tlp.translateFrom == L"?") ? codes.at(tlp.translateFrom) : codes.at(tlp.translateFrom).substr(0, 2), codes.at(tlp.translateTo), Escape(escaped)));
} }