-
Notifications
You must be signed in to change notification settings - Fork 85
Launcher language #1832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Launcher language #1832
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #include "resource.h" | ||
| #include <windows.h> | ||
| #include <commctrl.h> | ||
|
|
||
| LANGUAGE LANG_GERMAN, SUBLANG_GERMAN | ||
|
|
||
| STRINGTABLE | ||
| BEGIN | ||
| IDC_TEXT_LOGIN "Anmelden" | ||
| IDC_TEXT_QUIT "Beenden" | ||
| IDC_TEXT_ACCOUNT "Kontoname:" | ||
| IDC_TEXT_PASSWORD "Passwort:" | ||
| IDC_TEXT_LANGUAGE "Sprache:" | ||
| IDC_TEXT_REMEMBER_PASS "Passwort merken:" | ||
| IDC_TEXT_NEED_ACCOUNT "Konto erstellen?" | ||
| IDC_TEXT_DONATE "Spenden" | ||
|
|
||
| IDC_TEXT_ACCEPT "Akzeptieren" | ||
| IDC_TEXT_DECLINE "Ablehnen" | ||
|
|
||
| IDC_TEXT_AUTH "Authentifizierung fehlgeschlagen. Bitte versuchen Sie es erneut." | ||
| END | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,22 @@ | ||||||||
| #include "resource.h" | ||||||||
| #include <windows.h> | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| #include <commctrl.h> | ||||||||
|
|
||||||||
| LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US | ||||||||
|
|
||||||||
| STRINGTABLE | ||||||||
| BEGIN | ||||||||
| IDC_TEXT_LOGIN "Login" | ||||||||
| IDC_TEXT_QUIT "Quit" | ||||||||
| IDC_TEXT_ACCOUNT "Account name:" | ||||||||
| IDC_TEXT_PASSWORD "Password:" | ||||||||
| IDC_TEXT_LANGUAGE "Language:" | ||||||||
| IDC_TEXT_REMEMBER_PASS "Remember Password:" | ||||||||
| IDC_TEXT_NEED_ACCOUNT "Need an account?" | ||||||||
| IDC_TEXT_DONATE "Donate" | ||||||||
|
|
||||||||
| IDC_TEXT_ACCEPT "Accept" | ||||||||
| IDC_TEXT_DECLINE "Decline" | ||||||||
|
|
||||||||
| IDC_TEXT_AUTH "Authentication failed. Please try again." | ||||||||
| END | ||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -579,6 +579,13 @@ INT_PTR CALLBACK AuthFailedDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, L | |||||||||||||||||||||||||
| return FALSE; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| static const char* LoadLocalizedString(UINT nID) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| static char buffer[256]; | ||||||||||||||||||||||||||
| LoadStringA(gHInst, nID, buffer, sizeof(buffer)); | ||||||||||||||||||||||||||
| return buffer; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
Comment on lines
+582
to
+587
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In order to best support all languages, we should probably use unicode here. Also, per the documentation, we can ask for a read only pointer to the string and avoid the copy.
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| INT_PTR CALLBACK UruTOSDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| switch( uMsg ) | ||||||||||||||||||||||||||
|
|
@@ -598,16 +605,19 @@ INT_PTR CALLBACK UruTOSDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| SetDlgItemTextW(hwndDlg, IDC_URULOGIN_EULATEXT, | ||||||||||||||||||||||||||
| ST::string(eula, ST::substitute_invalid).to_wchar().data()); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| SetDlgItemText(hwndDlg, IDC_BUTTON_ACCEPT, LoadLocalizedString(IDC_TEXT_ACCEPT)); | ||||||||||||||||||||||||||
| SetDlgItemText(hwndDlg, IDC_BUTTON_DECLINE, LoadLocalizedString(IDC_TEXT_DECLINE)); | ||||||||||||||||||||||||||
|
Comment on lines
+609
to
+610
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| else // no TOS found, go ahead | ||||||||||||||||||||||||||
| EndDialog(hwndDlg, true); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| case WM_COMMAND: | ||||||||||||||||||||||||||
| if (HIWORD(wParam) == BN_CLICKED && (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)) | ||||||||||||||||||||||||||
| if (HIWORD(wParam) == BN_CLICKED && (LOWORD(wParam) == IDC_BUTTON_ACCEPT || LOWORD(wParam) == IDC_BUTTON_DECLINE)) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| bool ok = (LOWORD(wParam) == IDOK); | ||||||||||||||||||||||||||
| bool ok = (LOWORD(wParam) == IDC_BUTTON_ACCEPT); | ||||||||||||||||||||||||||
| EndDialog(hwndDlg, ok); | ||||||||||||||||||||||||||
| return TRUE; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
@@ -722,6 +732,23 @@ static size_t CurlCallback(void *buffer, size_t size, size_t nmemb, void *param) | |||||||||||||||||||||||||
| return size * nmemb; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| void SetWindowsUILanguage(plLocalization::Language lang) | ||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| LANGID langId; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| switch (lang) { | ||||||||||||||||||||||||||
| case plLocalization::kGerman: | ||||||||||||||||||||||||||
| langId = MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN); | ||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| default: | ||||||||||||||||||||||||||
| langId = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US); | ||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| SetThreadUILanguage(langId); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| INT_PTR CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| static LoginDialogParam* pLoginParam; | ||||||||||||||||||||||||||
|
|
@@ -835,9 +862,9 @@ INT_PTR CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| case WM_COMMAND: | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| if (HIWORD(wParam) == BN_CLICKED && (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)) | ||||||||||||||||||||||||||
| if (HIWORD(wParam) == BN_CLICKED && (LOWORD(wParam) == IDC_BUTTON_LOGIN || LOWORD(wParam) == IDC_BUTTON_CANCEL)) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| bool ok = (LOWORD(wParam) == IDOK); | ||||||||||||||||||||||||||
| bool ok = (LOWORD(wParam) == IDC_BUTTON_LOGIN); | ||||||||||||||||||||||||||
| if (ok) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| wchar_t password[kMaxPasswordLength]; | ||||||||||||||||||||||||||
|
|
@@ -896,6 +923,16 @@ INT_PTR CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| return TRUE; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| else if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_LANGUAGE) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| HWND hCombo = (HWND)lParam; | ||||||||||||||||||||||||||
| int currentIndex = (int)SendMessage(hCombo, CB_GETCURSEL, 0, 0); | ||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if (currentIndex != CB_ERR) { | ||||||||||||||||||||||||||
| plLocalization::Language new_language = (plLocalization::Language)SendMessage(GetDlgItem(hwndDlg, IDC_LANGUAGE), CB_GETCURSEL, 0, 0L); | ||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we could just cast |
||||||||||||||||||||||||||
| SetWindowsUILanguage(new_language); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.