diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-05-24 01:54:54 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-05-24 01:54:54 +0000 |
| commit | 5334f89af8a27e48365b2e47f5b5256c7debb450 (patch) | |
| tree | 6a02d1631dd3f7bee6ed49a07abe0d42584beedc | |
| parent | e594a282ee9f0ed44e31ee787a36900d39fe96be (diff) | |
| download | pcsxr-5334f89af8a27e48365b2e47f5b5256c7debb450.tar.gz | |
Also show Japanese titles for Windows, use UTF-8 for translations under Windows (Trad. Chinese or Russian are shown properly under Simp. Chinese OS now).
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@48637 e17a0e51-4ae3-4d35-97c3-1a29b211df97
| -rw-r--r-- | ChangeLog | 6 | ||||
| -rw-r--r-- | win32/gui/WndMain.c | 11 | ||||
| -rw-r--r-- | win32/intl/gettext.c | 19 |
3 files changed, 33 insertions, 3 deletions
@@ -1,3 +1,9 @@ +May 24, 2010 Wei Mingzhi <whistler_wmz@users.sf.net> + + * win32/gui/WndMain.c: Also show Japanese titles properly for Windows + (need to set ACP to east-asian languages). + * win32/intl/gettext.c: Added a hack for UTF-8 support. + May 23, 2010 Wei Mingzhi <whistler_wmz@users.sf.net> * AUTHORS: Updated info. diff --git a/win32/gui/WndMain.c b/win32/gui/WndMain.c index 3cbc88d5..c48f34ce 100644 --- a/win32/gui/WndMain.c +++ b/win32/gui/WndMain.c @@ -843,14 +843,21 @@ void UpdateMcdItems(int mcd, int idc) { void McdListGetDispInfo(int mcd, int idc, LPNMHDR pnmh) {
LV_DISPINFO *lpdi = (LV_DISPINFO *)pnmh;
McdBlock *Info;
+ char buf[256], buftitle[256];
- Info = &Blocks[mcd-1][lpdi->item.iItem];
+ Info = &Blocks[mcd - 1][lpdi->item.iItem];
switch (lpdi->item.iSubItem) {
case 0:
switch (Info->Flags & 0xF) {
case 1:
- lpdi->item.pszText = Info->Title;
+ if (MultiByteToWideChar(932, 0, (LPCSTR)Info->sTitle, -1, (LPWSTR)buf, sizeof(buf)) == 0) {
+ lpdi->item.pszText = Info->Title;
+ } else if (WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)buf, -1, (LPSTR)buftitle, sizeof(buftitle), NULL, NULL) == 0) {
+ lpdi->item.pszText = Info->Title;
+ } else {
+ lpdi->item.pszText = buftitle;
+ }
break;
case 2:
lpdi->item.pszText = _("mid link block");
diff --git a/win32/intl/gettext.c b/win32/intl/gettext.c index b0f69a7b..18b3d81d 100644 --- a/win32/intl/gettext.c +++ b/win32/intl/gettext.c @@ -52,6 +52,8 @@ # define DGETTEXT dgettext__ #endif +#include <windows.h> // Added by Wei Mingzhi 5-4-2010 + /* Look up MSGID in the current default message catalog for the current LC_MESSAGES locale. If not found, returns MSGID itself (the default text). */ @@ -59,7 +61,22 @@ char * GETTEXT (msgid) const char *msgid; { - return DGETTEXT (NULL, msgid); +// return DGETTEXT (NULL, msgid); + + // 5-24-2010 Wei Mingzhi + // Hack for UTF-8 support + char *t = DGETTEXT(NULL, msgid); + static char buf[16384], bufout[16384]; + + if (MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)t, -1, (LPWSTR)buf, sizeof(buf)) == 0) { + return t; + } + + if (WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)buf, -1, (LPSTR)bufout, sizeof(bufout), NULL, NULL) == 0) { + return t; + } + + return bufout; } #ifdef _LIBC |
