diff options
author | George Hazan <george.hazan@gmail.com> | 2023-11-06 18:45:45 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-11-06 18:45:51 +0300 |
commit | 9b480a3d2721f5fff3236e5081bb559d7d9baea5 (patch) | |
tree | 16e0c6b9146f3227a69f4e105bccb433cbe3a7d7 /protocols | |
parent | d8bdafe7af3a74e9b84f78bfd74b3093e6a66b16 (diff) |
fixes #3851 (Omegle: сделать список языков переводимым)
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Omegle/src/communication.cpp | 25 | ||||
-rw-r--r-- | protocols/Omegle/src/connection.cpp | 6 | ||||
-rw-r--r-- | protocols/Omegle/src/constants.h | 88 | ||||
-rw-r--r-- | protocols/Omegle/src/dialogs.cpp | 117 |
4 files changed, 121 insertions, 115 deletions
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index dfd1dc4dd4..060430a9ec 100644 --- a/protocols/Omegle/src/communication.cpp +++ b/protocols/Omegle/src/communication.cpp @@ -161,31 +161,6 @@ bool Omegle_client::handle_error(const std::string &method, bool force_disconnec //////////////////////////////////////////////////////////////////////////////
-std::string Omegle_client::get_server(bool not_last)
-{
- int q = not_last ? 1 : 0;
-
- int server = db_get_b(0, parent->m_szModuleName, OMEGLE_KEY_SERVER, 0);
- if (server < 0 || server >= (int)(_countof(servers) - q))
- server = 0;
-
- if (server == 0) {
- srand(::time(0));
- server = (rand() % (_countof(servers) - 1 - q)) + 1;
- }
-
- return servers[server];
-}
-
-std::string Omegle_client::get_language()
-{
- int language = db_get_b(0, parent->m_szModuleName, OMEGLE_KEY_LANGUAGE, 0);
- if (language < 0 || language >= (_countof(languages)))
- language = 0;
-
- return language > 0 ? languages[language].id : "en";
-}
-
std::string Omegle_client::choose_server(int request_type)
{
switch (request_type)
diff --git a/protocols/Omegle/src/connection.cpp b/protocols/Omegle/src/connection.cpp index db2b73970c..f0f40221f1 100644 --- a/protocols/Omegle/src/connection.cpp +++ b/protocols/Omegle/src/connection.cpp @@ -22,6 +22,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
+// Known server messages, only to inform lpgen
+const char *server_messages[] = {
+ LPGEN("Stranger is using Omegle's mobile Web site (omegle.com on a phone or tablet)"),
+ LPGEN("You both speak the same language.")
+};
+
void OmegleProto::SignOn(void*)
{
SYSTEMTIME t;
diff --git a/protocols/Omegle/src/constants.h b/protocols/Omegle/src/constants.h index 5bc923f4a3..960a07e980 100644 --- a/protocols/Omegle/src/constants.h +++ b/protocols/Omegle/src/constants.h @@ -45,91 +45,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define OMEGLE_REQUEST_TYPING_START 310 // started typing
#define OMEGLE_REQUEST_TYPING_STOP 311 // stoped typing
#define OMEGLE_REQUEST_RECAPTCHA 400 // recaptcha handling
-
-// Servers list
-//static const char *servers[] = {"Random", "bajor", "cardassia", "promenade", "odo-bucket", "ferengi", "quilt", "empok-nor", "quibbler"};
-static const char *servers[] = { LPGEN("Random"), "front1", "front2", "front3", "front4", "front5", "front6", "front7", "front8", "front9", "front10", "front11", "front12", "front13", "front14", "front15", "front16", "front17", "front18", "front19", "front20", "front21", "front22", "front23", "front24", "front25", "front26", "front27", "front28", "front29", "front30", "front31", "front32" };
-
-static const struct {
- const char *id;
- const char *lang;
-} languages[] = {
- { "en", "English" },
- { "af", "Afrikaans" },
- { "sq", "Albanian" },
- { "ar", "Arabic" },
- { "hy", "Armenian" },
- { "az", "Azerbaijani" },
- { "eu", "Basque" },
- { "be", "Belarusian" },
- { "bn", "Bengali" },
- { "bs", "Bosnian" },
- { "bg", "Bulgarian" },
- { "ceb", "Cebuanese" },
- { "cs", "Czech" },
- { "zh-CN", "Chinese (simplified)" },
- { "zh-TW", "Chinese (traditional)" },
- { "da", "Danish" },
- { "eo", "Esperanto" },
- { "et", "Estonian" },
- { "tl", "Philipino" },
- { "fi", "Finnish" },
- { "fr", "French" },
- { "gl", "Galician" },
- { "ka", "Georgian" },
- { "gu", "Gujarati" },
- { "ht", "Haitian Creole" },
- { "iw", "Hebrew" },
- { "hi", "Hindi" },
- { "hmn", "Hmong" },
- { "nl", "Dutch" },
- { "hr", "Croat" },
- { "id", "Indonesian" },
- { "ga", "Irish" },
- { "is", "Icelandic" },
- { "it", "Italian" },
- { "ja", "Japanese" },
- { "jw", "Javanese" },
- { "yi", "Yiddish" },
- { "kn", "Kannada" },
- { "ca", "Catalan" },
- { "km", "Khmer" },
- { "ko", "Korean" },
- { "lo", "Lao" },
- { "la", "Latina" },
- { "lt", "Lithuanian" },
- { "lv", "Latvian" },
- { "hu", "Hungarian" },
- { "mk", "Macedonian" },
- { "ms", "Malay" },
- { "mt", "Maltese" },
- { "mr", "Marathi" },
- { "de", "German" },
- { "no", "Norwegian" },
- { "fa", "Persian" },
- { "pl", "Polish" },
- { "pt", "Portugese" },
- { "ro", "Romaсian" },
- { "ru", "Russian" },
- { "el", "Greek" },
- { "sk", "Slovak" },
- { "sl", "Slovenian" },
- { "sr", "Serbian" },
- { "sw", "Swahili" },
- { "es", "Spanish" },
- { "sv", "Swedish" },
- { "ta", "Tamil" },
- { "te", "Telugu" },
- { "th", "Thai" },
- { "tr", "Turkish" },
- { "uk", "Ukrainian" },
- { "ur", "Urdu" },
- { "cy", "Welsh" },
- { "vi", "Vietnamese" }
-};
-
-// Known server messages, only to inform lpgen
-static const char *server_messages[] = {
- LPGEN("Stranger is using Omegle's mobile Web site (omegle.com on a phone or tablet)"),
- LPGEN("You both speak the same language.")
-};
diff --git a/protocols/Omegle/src/dialogs.cpp b/protocols/Omegle/src/dialogs.cpp index ee243053c0..33ac1453a4 100644 --- a/protocols/Omegle/src/dialogs.cpp +++ b/protocols/Omegle/src/dialogs.cpp @@ -22,6 +22,119 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
+struct
+{
+ const char *id;
+ const wchar_t *lang;
+}
+static languages[] = {
+ { "en", LPGENW("English") },
+ { "af", LPGENW("Afrikaans") },
+ { "sq", LPGENW("Albanian") },
+ { "ar", LPGENW("Arabic") },
+ { "hy", LPGENW("Armenian") },
+ { "az", LPGENW("Azerbaijani") },
+ { "eu", LPGENW("Basque") },
+ { "be", LPGENW("Belarusian") },
+ { "bn", LPGENW("Bengali") },
+ { "bs", LPGENW("Bosnian") },
+ { "bg", LPGENW("Bulgarian") },
+ { "ceb", LPGENW("Cebuanese") },
+ { "cs", LPGENW("Czech") },
+ { "zh-CN", LPGENW("Chinese (simplified)") },
+ { "zh-TW", LPGENW("Chinese (traditional)") },
+ { "da", LPGENW("Danish") },
+ { "eo", LPGENW("Esperanto") },
+ { "et", LPGENW("Estonian") },
+ { "tl", LPGENW("Philipino") },
+ { "fi", LPGENW("Finnish") },
+ { "fr", LPGENW("French") },
+ { "gl", LPGENW("Galician") },
+ { "ka", LPGENW("Georgian") },
+ { "gu", LPGENW("Gujarati") },
+ { "ht", LPGENW("Haitian Creole") },
+ { "iw", LPGENW("Hebrew") },
+ { "hi", LPGENW("Hindi") },
+ { "hmn", LPGENW("Hmong") },
+ { "nl", LPGENW("Dutch") },
+ { "hr", LPGENW("Croat") },
+ { "id", LPGENW("Indonesian") },
+ { "ga", LPGENW("Irish") },
+ { "is", LPGENW("Icelandic") },
+ { "it", LPGENW("Italian") },
+ { "ja", LPGENW("Japanese") },
+ { "jw", LPGENW("Javanese") },
+ { "yi", LPGENW("Yiddish") },
+ { "kn", LPGENW("Kannada") },
+ { "ca", LPGENW("Catalan") },
+ { "km", LPGENW("Khmer") },
+ { "ko", LPGENW("Korean") },
+ { "lo", LPGENW("Lao") },
+ { "la", LPGENW("Latina") },
+ { "lt", LPGENW("Lithuanian") },
+ { "lv", LPGENW("Latvian") },
+ { "hu", LPGENW("Hungarian") },
+ { "mk", LPGENW("Macedonian") },
+ { "ms", LPGENW("Malay") },
+ { "mt", LPGENW("Maltese") },
+ { "mr", LPGENW("Marathi") },
+ { "de", LPGENW("German") },
+ { "no", LPGENW("Norwegian") },
+ { "fa", LPGENW("Persian") },
+ { "pl", LPGENW("Polish") },
+ { "pt", LPGENW("Portugese") },
+ { "ro", LPGENW("Romaсian") },
+ { "ru", LPGENW("Russian") },
+ { "el", LPGENW("Greek") },
+ { "sk", LPGENW("Slovak") },
+ { "sl", LPGENW("Slovenian") },
+ { "sr", LPGENW("Serbian") },
+ { "sw", LPGENW("Swahili") },
+ { "es", LPGENW("Spanish") },
+ { "sv", LPGENW("Swedish") },
+ { "ta", LPGENW("Tamil") },
+ { "te", LPGENW("Telugu") },
+ { "th", LPGENW("Thai") },
+ { "tr", LPGENW("Turkish") },
+ { "uk", LPGENW("Ukrainian") },
+ { "ur", LPGENW("Urdu") },
+ { "cy", LPGENW("Welsh") },
+ { "vi", LPGENW("Vietnamese") }
+};
+
+std::string Omegle_client::get_language()
+{
+ int language = db_get_b(0, parent->m_szModuleName, OMEGLE_KEY_LANGUAGE, 0);
+ if (language < 0 || language >= (_countof(languages)))
+ language = 0;
+
+ return language > 0 ? languages[language].id : "en";
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Servers list
+
+static const char *servers[] = { LPGEN("Random"), "front1", "front2", "front3", "front4", "front5", "front6", "front7", "front8", "front9", "front10", "front11", "front12", "front13", "front14", "front15", "front16", "front17", "front18", "front19", "front20", "front21", "front22", "front23", "front24", "front25", "front26", "front27", "front28", "front29", "front30", "front31", "front32" };
+
+std::string Omegle_client::get_server(bool not_last)
+{
+ int q = not_last ? 1 : 0;
+
+ int server = db_get_b(0, parent->m_szModuleName, OMEGLE_KEY_SERVER, 0);
+ if (server < 0 || server >= (int)(_countof(servers) - q))
+ server = 0;
+
+ if (server == 0) {
+ srand(::time(0));
+ server = (rand() % (_countof(servers) - 1 - q)) + 1;
+ }
+
+ return servers[server];
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Options
+
static BOOL LoadDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting, uint8_t bDef = 0)
{
BOOL state = db_get_b(0, ppro->m_szModuleName, szSetting, bDef);
@@ -75,7 +188,7 @@ INT_PTR CALLBACK OmegleAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARA // Language
for (size_t i = 0; i < _countof(languages); i++)
- SendDlgItemMessageA(hwnd, IDC_LANGUAGE, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(languages[i].lang)));
+ SendDlgItemMessageW(hwnd, IDC_LANGUAGE, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(TranslateW(languages[i].lang)));
SendDlgItemMessage(hwnd, IDC_LANGUAGE, CB_SETCURSEL, db_get_b(0, proto->m_szModuleName, OMEGLE_KEY_LANGUAGE, 0), 0);
LoadDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME);
@@ -146,7 +259,7 @@ INT_PTR CALLBACK OmegleOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARA // Language
for (size_t i = 0; i < _countof(languages); i++)
- SendDlgItemMessageA(hwnd, IDC_LANGUAGE, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(languages[i].lang)));
+ SendDlgItemMessageW(hwnd, IDC_LANGUAGE, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(TranslateW(languages[i].lang)));
SendDlgItemMessage(hwnd, IDC_LANGUAGE, CB_SETCURSEL, db_get_b(0, proto->m_szModuleName, OMEGLE_KEY_LANGUAGE, 0), 0);
LoadDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME);
|