diff --git a/extensions/bingtranslate.cpp b/extensions/bingtranslate.cpp index 8c48ce7..2bef5c2 100644 --- a/extensions/bingtranslate.cpp +++ b/extensions/bingtranslate.cpp @@ -1,4 +1,5 @@ #include "extension.h" +#include "text.h" #include #include #include @@ -64,8 +65,8 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved { translateTo = QInputDialog::getItem( nullptr, - "Select Language", - "What language should Bing translate to?", + SELECT_LANGUAGE, + BING_PROMPT, languages, 0, false, nullptr, Qt::WindowCloseButtonHint @@ -139,7 +140,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) requestTimes.erase(std::remove_if(requestTimes.begin(), requestTimes.end(), [&](DWORD requestTime) { return GetTickCount() - requestTime > 60 * 1000; }), requestTimes.end()); if (!sentenceInfo["current select"] && requestTimes.size() > 30) { - sentence += L"\r\nToo many translation requests: refuse to make more"; + sentence += TOO_MANY_TRANS_REQUESTS; return true; } } @@ -148,7 +149,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) Translate(sentence, translateFrom, translateTo); translation = Translate(sentence, translateFrom, translateTo); for (auto& c : translation) if (c == L'\\') c = 0x200b; - if (translation.empty()) translation = L"Error while translating."; + if (translation.empty()) translation = TRANSLATION_ERROR; sentence += L"\r\n" + translation; return true; -} \ No newline at end of file +} diff --git a/extensions/googletranslate.cpp b/extensions/googletranslate.cpp index 40011b0..acf41fc 100644 --- a/extensions/googletranslate.cpp +++ b/extensions/googletranslate.cpp @@ -1,4 +1,5 @@ #include "extension.h" +#include "text.h" #include #include #include @@ -80,8 +81,8 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved { translateTo = QInputDialog::getItem( nullptr, - "Select Language", - "What language should Google translate to?", + SELECT_LANGUAGE, + GOOGLE_PROMPT, languages, 0, false, nullptr, Qt::WindowCloseButtonHint @@ -143,7 +144,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) requestTimes.erase(std::remove_if(requestTimes.begin(), requestTimes.end(), [&](DWORD requestTime) { return GetTickCount() - requestTime > 60 * 1000; }), requestTimes.end()); if (!sentenceInfo["current select"] && requestTimes.size() > 30) { - sentence += L"\r\nToo many translation requests: refuse to make more"; + sentence += TOO_MANY_TRANS_REQUESTS; return true; } } @@ -203,7 +204,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) } } - if (translation.empty()) translation = L"Error while translating (TKK=" + std::to_wstring(TKK) + L")"; + if (translation.empty()) translation = TRANSLATION_ERROR + (L" (TKK=" + std::to_wstring(TKK) + L")"); sentence += L"\r\n" + translation; return true; -} \ No newline at end of file +} diff --git a/extensions/regexfilter.cpp b/extensions/regexfilter.cpp index 5855184..e467f1f 100644 --- a/extensions/regexfilter.cpp +++ b/extensions/regexfilter.cpp @@ -1,4 +1,5 @@ #include "extension.h" +#include "text.h" #include #include #include @@ -22,12 +23,12 @@ struct : QMainWindow { { std::lock_guard l(m); try { regex = newRegex.toStdWString(); } - catch (...) { return output->setText("Invalid regex"); } - output->setText("Currently filtering: " + newRegex); + catch (...) { return output->setText(INVALID_REGEX); } + output->setText(CURRENT_FILTER + newRegex); }); QMainWindow::resize(350, 60); QMainWindow::setCentralWidget(centralWidget); - QMainWindow::setWindowTitle("Regex Filter"); + QMainWindow::setWindowTitle(REGEX_FILTER); QMainWindow::show(); } }*window = nullptr; diff --git a/include/text.h b/include/text.h index 1083046..e903876 100644 --- a/include/text.h +++ b/include/text.h @@ -55,6 +55,14 @@ constexpr auto TOO_MANY_HOOKS = u8"Textractor: too many hooks: can't insert"; constexpr auto FUNC_MISSING = u8"Textractor: function not present"; constexpr auto MODULE_MISSING = u8"Textractor: module not present"; constexpr auto GARBAGE_MEMORY = u8"Textractor: memory constantly changing, useless to read"; +constexpr auto SELECT_LANGUAGE = u8"Select Language"; +constexpr auto BING_PROMPT = u8"What language should Bing translate to?"; +constexpr auto GOOGLE_PROMPT = u8"What language should Google translate to?"; +constexpr auto TOO_MANY_TRANS_REQUESTS = L"\r\nToo many translation requests: refuse to make more"; +constexpr auto TRANSLATION_ERROR = L"Error while translating"; +constexpr auto REGEX_FILTER = u8"Regex Filter"; +constexpr auto INVALID_REGEX = u8"Invalid regex"; +constexpr auto CURRENT_FILTER = u8"Currently filtering: "; #endif // ENGLISH #ifdef TURKISH @@ -66,7 +74,7 @@ constexpr auto SETTINGS = u8"Ayarlar"; constexpr auto EXTENSIONS = u8"Uzantılar"; constexpr auto SELECT_PROCESS = u8"İşlem Seçin"; constexpr auto ATTACH_INFO = u8"Bağlanmak istediğiniz işlemi görmüyorsanız yönetici olarak çalıştırmayı deneyin"; -constexpr auto CODE_INFODUMP = u8"Hook kodunu girin\r\n" +constexpr auto CODE_INFODUMP = u8"Kanca kodunu girin\r\n" u8"/H{A|B|W|S|Q|V}[N][kod_sayfası#]göreli_veri_konumu[*göreli_referanstan_ayırma_konumu1][:göreli_ayırma_konumu[*göreli_referanstan_ayırma_konumu2]]@adres[:modül[:fonksiyon]]\r\n" u8"YA DA\r\n" u8"Okuma kodunu girin\r\n"