Merge pull request #520 from RaiKoHoff/DevMultiLingual

Dev MultiLingual
This commit is contained in:
Rainer Kottenhoff 2018-06-13 00:54:51 +02:00 committed by GitHub
commit f32bbf66e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 73 additions and 35 deletions

View File

@ -120,6 +120,8 @@
#define IDS_MUI_TITLE_FIXCUR 15026
#define IDS_MUI_TITLE_RELARB 15027
#define IDS_MUI_TITLE_FIXARB 15028
#define IDS_MUI_ABOUT_RTF_1 15029
#define IDS_MUI_ABOUT_RTF_2 15030
#define IDR_MAINWND 16000
#define IDR_MAINWND128 16001

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -429,7 +429,7 @@ static DWORD CALLBACK _LoadRtfCallback(
// ----------------------------------------------------------------------------
static char* pAboutInfoResource = ABOUT_INFO_RTF;
static char pAboutResource[8192] = { '\0' };
static char* pAboutInfo;
@ -504,9 +504,19 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SETEVENTMASK, 0, (LPARAM)(ENM_LINK)); // link click
#if true
char pAboutRes1[4000];
GetLngStringA(IDS_MUI_ABOUT_RTF_1, pAboutRes1, COUNTOF(pAboutRes1));
char pAboutRes2[4000];
GetLngStringA(IDS_MUI_ABOUT_RTF_2, pAboutRes2, COUNTOF(pAboutRes2));
StringCchCopyA(pAboutResource, COUNTOF(pAboutResource), pAboutRes1);
StringCchCatA(pAboutResource, COUNTOF(pAboutResource), pAboutRes2);
EDITSTREAM editStreamIn = { (DWORD_PTR)&pAboutInfo, 0, _LoadRtfCallback };
pAboutInfo = pAboutInfoResource;
pAboutInfo = pAboutResource;
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_STREAMIN, SF_RTF, (LPARAM)&editStreamIn);
//DWORD dwSize = _LoadStringEx(IDR_ABOUTINFO_RTF, L"RTF", NULL);
//if (dwSize != 0) {

View File

@ -616,7 +616,7 @@ bool SetWindowTitle(HWND hwnd,UINT uIDAppName,bool bIsElevated,UINT uIDUntitled,
}
if (bIsElevated) {
FormatLngString(szElevatedAppName,COUNTOF(szElevatedAppName),IDS_MUI_APPTITLE_ELEVATED,szAppName);
FormatLngStringW(szElevatedAppName,COUNTOF(szElevatedAppName),IDS_MUI_APPTITLE_ELEVATED,szAppName);
StringCchCopyN(szAppName,COUNTOF(szAppName),szElevatedAppName,COUNTOF(szElevatedAppName));
}
@ -1200,34 +1200,57 @@ bool IsCmdEnabled(HWND hwnd,UINT uId)
//=============================================================================
//
// LoadLngString()
// LoadLngStringW()
//
int LoadLngString(UINT uID, LPTSTR lpBuffer, int nBufferMax)
int LoadLngStringW(UINT uID, LPTSTR lpBuffer, int nBufferMax)
{
const int nLen = LoadString(g_hLngResContainer, uID, lpBuffer, nBufferMax);
const int nLen = LoadStringW(g_hLngResContainer, uID, lpBuffer, nBufferMax);
return (nLen != 0) ? nLen : LoadStringW(g_hInstance, uID, lpBuffer, nBufferMax);
}
return (nLen != 0) ? nLen : LoadString(g_hInstance, uID, lpBuffer, nBufferMax);
//=============================================================================
//
// LoadLngStringA()
//
int LoadLngStringA(UINT uID, LPSTR lpBuffer, int nBufferMax)
{
const int nLen = LoadStringA(g_hLngResContainer, uID, lpBuffer, nBufferMax);
return (nLen != 0) ? nLen : LoadStringA(g_hInstance, uID, lpBuffer, nBufferMax);
}
//=============================================================================
//
// FormatLngString()
// FormatLngStringW()
//
int FormatLngString(LPWSTR lpOutput, int nOutput, UINT uIdFormat, ...)
int FormatLngStringW(LPWSTR lpOutput, int nOutput, UINT uIdFormat, ...)
{
static WCHAR pBuffer[XHUGE_BUFFER];
pBuffer[0] = L'\0';
if (LoadLngString(uIdFormat, pBuffer, nOutput))
if (LoadLngStringW(uIdFormat, pBuffer, nOutput))
{
StringCchVPrintf(lpOutput, nOutput, pBuffer, (LPVOID)((PUINT_PTR)&uIdFormat + 1));
StringCchVPrintfW(lpOutput, nOutput, pBuffer, (LPVOID)((PUINT_PTR)&uIdFormat + 1));
}
return (int)StringCchLen(lpOutput, nOutput);
return (int)StringCchLenW(lpOutput, nOutput);
}
//=============================================================================
//
// FormatLngStringA()
//
int FormatLngStringA(LPSTR lpOutput, int nOutput, UINT uIdFormat, ...)
{
static CHAR pBuffer[XHUGE_BUFFER];
pBuffer[0] = L'\0';
if (LoadLngStringA(uIdFormat, pBuffer, nOutput))
{
StringCchVPrintfA(lpOutput, nOutput, pBuffer, (LPVOID)((PUINT_PTR)&uIdFormat + 1));
}
return (int)StringCchLenA(lpOutput, nOutput);
}
//=============================================================================

View File

@ -191,9 +191,12 @@ bool IsCmdEnabled(HWND, UINT);
#define StrEnd(pStart) (pStart + lstrlen(pStart))
#define GetLngString(id,pb,cb) LoadLngString((id),(pb),(cb))
int LoadLngString(UINT uID, LPWSTR lpBuffer, int nBufferMax);
int FormatLngString(LPWSTR, int, UINT, ...);
#define GetLngString(id,pb,cb) LoadLngStringW((id),(pb),(cb))
#define GetLngStringA(id,pb,cb) LoadLngStringA((id),(pb),(cb))
int LoadLngStringW(UINT uID, LPWSTR lpBuffer, int nBufferMax);
int LoadLngStringA(UINT uID, LPSTR lpBuffer, int nBufferMax);
int FormatLngStringW(LPWSTR, int, UINT, ...);
int FormatLngStringA(LPSTR, int, UINT, ...);
bool GetKnownFolderPath(REFKNOWNFOLDERID, LPWSTR, size_t);

View File

@ -7907,7 +7907,7 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
if ((s_iLnFromPos != iLnFromPos) || (s_iLnCnt != iLnCnt))
{
FormatLngString(tchStatusBar[STATUS_DOCLINE], txtWidth, IDS_STATUS_DOCLINE, g_mxStatusBarPrefix[STATUS_DOCLINE], tchLn, tchLines);
FormatLngStringW(tchStatusBar[STATUS_DOCLINE], txtWidth, IDS_STATUS_DOCLINE, g_mxStatusBarPrefix[STATUS_DOCLINE], tchLn, tchLines);
s_iLnFromPos = iLnFromPos;
s_iLnCnt = iLnCnt;
bIsUpdateNeeded = true;
@ -7931,11 +7931,11 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
if (bMarkLongLines) {
StringCchPrintf(tchCols, COUNTOF(tchCols), L"%td", g_iLongLinesLimit);
FormatNumberStr(tchCols);
FormatLngString(tchStatusBar[STATUS_DOCCOLUMN], txtWidth, IDS_STATUS_DOCCOLUMN2, g_mxStatusBarPrefix[STATUS_DOCCOLUMN], tchCol, tchCols);
FormatLngStringW(tchStatusBar[STATUS_DOCCOLUMN], txtWidth, IDS_STATUS_DOCCOLUMN2, g_mxStatusBarPrefix[STATUS_DOCCOLUMN], tchCol, tchCols);
}
else {
tchCols[0] = L'\0';
FormatLngString(tchStatusBar[STATUS_DOCCOLUMN], txtWidth, IDS_STATUS_DOCCOLUMN, g_mxStatusBarPrefix[STATUS_DOCCOLUMN], tchCol);
FormatLngStringW(tchStatusBar[STATUS_DOCCOLUMN], txtWidth, IDS_STATUS_DOCCOLUMN, g_mxStatusBarPrefix[STATUS_DOCCOLUMN], tchCol);
}
s_iCol = iCol;
s_bmarkLongLines = bMarkLongLines;
@ -7972,8 +7972,8 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
tchSelB[0] = L'0'; tchSelB[1] = L'\0';
}
FormatLngString(tchStatusBar[STATUS_SELECTION], txtWidth, IDS_STATUS_SELECTION, g_mxStatusBarPrefix[STATUS_SELECTION], tchSel);
FormatLngString(tchStatusBar[STATUS_SELCTBYTES], txtWidth, IDS_STATUS_SELCTBYTES, g_mxStatusBarPrefix[STATUS_SELCTBYTES], tchSelB);
FormatLngStringW(tchStatusBar[STATUS_SELECTION], txtWidth, IDS_STATUS_SELECTION, g_mxStatusBarPrefix[STATUS_SELECTION], tchSel);
FormatLngStringW(tchStatusBar[STATUS_SELCTBYTES], txtWidth, IDS_STATUS_SELCTBYTES, g_mxStatusBarPrefix[STATUS_SELCTBYTES], tchSelB);
s_bIsSelCountable = bIsSelCountable;
s_iSelStart = iSelStart;
@ -8008,7 +8008,7 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
FormatNumberStr(tchLinesSelected);
}
FormatLngString(tchStatusBar[STATUS_SELCTLINES], txtWidth, IDS_STATUS_SELCTLINES, g_mxStatusBarPrefix[STATUS_SELCTLINES], tchLinesSelected);
FormatLngStringW(tchStatusBar[STATUS_SELCTLINES], txtWidth, IDS_STATUS_SELCTLINES, g_mxStatusBarPrefix[STATUS_SELCTLINES], tchLinesSelected);
s_bIsSelectionEmpty = bIsSelectionEmpty;
s_iLinesSelected = iLinesSelected;
@ -8042,7 +8042,7 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
StringCchCopy(tchOcc, COUNTOF(tchOcc), L"--");
}
FormatLngString(tchStatusBar[STATUS_OCCURRENCE], txtWidth, IDS_STATUS_OCCURRENCE, g_mxStatusBarPrefix[STATUS_OCCURRENCE], tchOcc);
FormatLngStringW(tchStatusBar[STATUS_OCCURRENCE], txtWidth, IDS_STATUS_OCCURRENCE, g_mxStatusBarPrefix[STATUS_OCCURRENCE], tchOcc);
s_bMOVisible = g_bMarkOccurrencesMatchVisible;
s_iMarkOccurrencesCount = g_iMarkOccurrencesCount;
@ -8057,7 +8057,7 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
DocPos const iTextLength = SciCall_GetTextLength();
if (s_iTextLength != iTextLength) {
StrFormatByteSize(iTextLength, tchBytes, COUNTOF(tchBytes));
FormatLngString(tchStatusBar[STATUS_DOCSIZE], txtWidth, IDS_STATUS_DOCSIZE, g_mxStatusBarPrefix[STATUS_DOCSIZE], tchBytes);
FormatLngStringW(tchStatusBar[STATUS_DOCSIZE], txtWidth, IDS_STATUS_DOCSIZE, g_mxStatusBarPrefix[STATUS_DOCSIZE], tchBytes);
s_iTextLength = iTextLength;
bIsUpdateNeeded = true;
}
@ -8180,7 +8180,7 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
else
StringCchCopy(tchReplOccs, COUNTOF(tchReplOccs), L"--");
FormatLngString(tchFRStatus, COUNTOF(tchFRStatus), IDS_FR_STATUS_FMT,
FormatLngStringW(tchFRStatus, COUNTOF(tchFRStatus), IDS_FR_STATUS_FMT,
tchLn, tchLines, tchCol, tchSel, tchOcc, tchReplOccs, FR_Status[g_FindReplaceMatchFoundState]);
SetWindowText(GetDlgItem(g_hwndDlgFindReplace, IDS_FR_STATUS_TEXT), tchFRStatus);
@ -8534,7 +8534,7 @@ bool FileIO(bool fLoad,LPCWSTR pszFileName,bool bSkipUnicodeDetect,bool bSkipANS
bool fSuccess;
DWORD dwFileAttributes;
FormatLngString(tch,COUNTOF(tch),(fLoad) ? IDS_MUI_LOADFILE : IDS_MUI_SAVEFILE, PathFindFileName(pszFileName));
FormatLngStringW(tch,COUNTOF(tch),(fLoad) ? IDS_MUI_LOADFILE : IDS_MUI_SAVEFILE, PathFindFileName(pszFileName));
BeginWaitCursor(tch);

View File

@ -71,7 +71,7 @@ void StatusUpdatePrintPage(int iPageNum)
{
WCHAR tch[32] = { L'\0' };
FormatLngString(tch,COUNTOF(tch),IDS_MUI_PRINTFILE,iPageNum);
FormatLngStringW(tch,COUNTOF(tch),IDS_MUI_PRINTFILE,iPageNum);
StatusSetText(g_hwndStatus,255,tch);
StatusSetSimple(g_hwndStatus,true);

View File

@ -5293,21 +5293,21 @@ bool Style_SelectFont(HWND hwnd,LPWSTR lpszStyle,int cchStyle, LPCWSTR sLexerNam
if (bGlobalDefaultStyle) {
if (bRelFontSize)
FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_RELBASE, sStyleName);
FormatLngStringW(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_RELBASE, sStyleName);
else
FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_FIXBASE, sStyleName);
FormatLngStringW(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_FIXBASE, sStyleName);
}
else if (bCurrentDefaultStyle) {
if (bRelFontSize)
FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_RELCUR, sLexerName, sStyleName);
FormatLngStringW(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_RELCUR, sLexerName, sStyleName);
else
FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_FIXCUR, sLexerName, sStyleName);
FormatLngStringW(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_FIXCUR, sLexerName, sStyleName);
}
else {
if (bRelFontSize)
FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_RELARB, sStyleName, sLexerName);
FormatLngStringW(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_RELARB, sStyleName, sLexerName);
else
FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_FIXARB, sStyleName, sLexerName);
FormatLngStringW(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_FIXARB, sStyleName, sLexerName);
}
if (bWithEffects)
@ -6136,7 +6136,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
}
else {
GetLngString(pCurrentLexer->resID, name, COUNTOF(name));
FormatLngString(label, COUNTOF(label), IDS_MUI_STY_LEXDEF, name);
FormatLngStringW(label, COUNTOF(label), IDS_MUI_STY_LEXDEF, name);
}
SetDlgItemText(hwnd, IDC_STYLELABEL_ROOT, label);
@ -6149,7 +6149,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
{
bIsStyleSelected = true;
GetLngString(pCurrentStyle->rid, name, COUNTOF(name));
FormatLngString(label, COUNTOF(label), IDS_MUI_STY_LEXSTYLE, name);
FormatLngStringW(label, COUNTOF(label), IDS_MUI_STY_LEXSTYLE, name);
SetDlgItemText(hwnd, IDC_STYLELABEL, label);
SetDlgItemText(hwnd, IDC_STYLEEDIT, pCurrentStyle->szValue);
}

Binary file not shown.