From ceb0dd68dbf7d0d82a516d06b125afc2beccb162 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Sun, 1 Mar 2020 06:47:28 -0700 Subject: [PATCH] find romaji --- extensions/googletranslate.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/googletranslate.cpp b/extensions/googletranslate.cpp index 1722ace..3272367 100644 --- a/extensions/googletranslate.cpp +++ b/extensions/googletranslate.cpp @@ -116,8 +116,8 @@ std::pair Translate(const std::wstring& text) if (httpRequest.response[0] == L'[') { std::wstring translation; - for (std::wsmatch results; std::regex_search(httpRequest.response, results, std::wregex(L"\\[\"(.*?)\",[n\"]")); httpRequest.response = results.suffix()) - if (!IsHash(results[1])) translation += std::wstring(results[1]) + L" "; + for (std::wsmatch results; std::regex_search(httpRequest.response, results, std::wregex(L"(?:\\[\\[|null,)\"([ -~]{3,}?)\"[,\\]]")); httpRequest.response = results.suffix()) + if (!IsHash(results[1])) translation += std::wstring(results[1]) + L"\n"; if (!translation.empty()) return { true, translation }; } return { false, FormatString(L"%s (TKK=%u)", TRANSLATION_ERROR, _InterlockedExchange(&TKK, 0)) };