Skip to content

Commit

Permalink
improve error handling and fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
Artikash committed Jun 7, 2021
1 parent 3b948c3 commit 444974e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion extensions/bingtranslate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ std::pair<bool, std::wstring> Translate(const std::wstring& text)
FormatString(L"/ttranslatev3?fromLang=%s&to=%s&text=%s%s", translateFrom.Copy(), translateTo.Copy(), Escape(text), token.Copy()).c_str()
})
if (auto translation = Copy(JSON::Parse(httpRequest.response)[0][L"translations"][0][L"text"].String())) return { true, translation.value() };
else return { false, FormatString(L"%s: %s", TRANSLATION_ERROR, httpRequest.response) };
else return { false, FormatString(L"%s (token=%s): %s", TRANSLATION_ERROR, std::exchange(token.Acquire().contents, L""), httpRequest.response) };
else return { false, FormatString(L"%s (code=%u)", TRANSLATION_ERROR, httpRequest.errorCode) };
}
4 changes: 2 additions & 2 deletions extensions/devtools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extern Settings settings;
namespace
{
QLabel* statusLabel;
AutoHandle<> process;
AutoHandle<> process = NULL;
QWebSocket webSocket;
std::atomic<int> idCounter = 0;
Synchronized<std::unordered_map<int, concurrency::task_completion_event<JSON::Value<wchar_t>>>> mapQueue;
Expand Down Expand Up @@ -161,7 +161,7 @@ namespace DevTools
int id = idCounter += 1;
if (!Connected()) return {};
mapQueue->try_emplace(id, response);
QMetaObject::invokeMethod(&webSocket, std::bind(&QWebSocket::sendTextMessage, webSocket, S(FormatString(LR"({"id":%d,"method":"%S","params":%s})", id, method, params))));
QMetaObject::invokeMethod(&webSocket, std::bind(&QWebSocket::sendTextMessage, &webSocket, S(FormatString(LR"({"id":%d,"method":"%S","params":%s})", id, method, params))));
try { if (auto result = create_task(response).get()[L"result"]) return result; } catch (...) {}
return {};
}
Expand Down

3 comments on commit 444974e

@JiinKhang
Copy link

@JiinKhang JiinKhang commented on 444974e Jun 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, when I translate from Japanese to English, I'm getting what it means, but I'm not getting the original in Japanese. The original Japanese font isn't showing up. Can you explain to me how?

@xressa
Copy link

@xressa xressa commented on 444974e Jun 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, when I translate from Japanese to English, I'm getting what it means, but I'm not getting the original in Japanese. The original Japanese font isn't showing up. Can you explain to me how?

in my experience, you need to change your system locale to japanese, you can change it from control panel via language/region option

@JiinKhang
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Xin chào, khi tôi dịch từ tiếng Nhật sang tiếng Anh, tôi hiểu ý nghĩa của nó, nhưng tôi không hiểu bản gốc bằng tiếng Nhật. Phông chữ gốc tiếng Nhật không hiển thị. Bạn có thể giải thích cho tôi làm thế nào?

theo kinh nghiệm của tôi, bạn cần thay đổi ngôn ngữ hệ thống của mình sang tiếng Nhật, bạn có thể thay đổi ngôn ngữ này từ bảng điều khiển thông qua tùy chọn ngôn ngữ / khu vực

Thanks!

Please sign in to comment.