forked from Public-Mirror/Textractor
google translate optimized
This commit is contained in:
parent
3c67f5a15d
commit
5523644ef9
@ -153,6 +153,8 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
|
||||
static unsigned TKK = 0;
|
||||
std::wstring translation;
|
||||
if (internet)
|
||||
{
|
||||
if (!TKK)
|
||||
{
|
||||
if (HINTERNET connection = WinHttpConnect(internet, L"translate.google.com", INTERNET_DEFAULT_HTTPS_PORT, 0))
|
||||
{
|
||||
@ -170,6 +172,8 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
|
||||
}
|
||||
WinHttpCloseHandle(connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (HINTERNET connection = WinHttpConnect(internet, L"translate.google.com", INTERNET_DEFAULT_HTTPS_PORT, 0))
|
||||
{
|
||||
@ -191,6 +195,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
|
||||
translation += std::wstring(results[1]) + L" ";
|
||||
for (auto& c : translation) if (c == L'\\') c = 0x200b;
|
||||
}
|
||||
else TKK = 0;
|
||||
}
|
||||
WinHttpCloseHandle(request);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user