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;
|
static unsigned TKK = 0;
|
||||||
std::wstring translation;
|
std::wstring translation;
|
||||||
if (internet)
|
if (internet)
|
||||||
|
{
|
||||||
|
if (!TKK)
|
||||||
{
|
{
|
||||||
if (HINTERNET connection = WinHttpConnect(internet, L"translate.google.com", INTERNET_DEFAULT_HTTPS_PORT, 0))
|
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);
|
WinHttpCloseHandle(connection);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (HINTERNET connection = WinHttpConnect(internet, L"translate.google.com", INTERNET_DEFAULT_HTTPS_PORT, 0))
|
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" ";
|
translation += std::wstring(results[1]) + L" ";
|
||||||
for (auto& c : translation) if (c == L'\\') c = 0x200b;
|
for (auto& c : translation) if (c == L'\\') c = 0x200b;
|
||||||
}
|
}
|
||||||
|
else TKK = 0;
|
||||||
}
|
}
|
||||||
WinHttpCloseHandle(request);
|
WinHttpCloseHandle(request);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user