Skip to content

Commit

Permalink
[INTL]
Browse files Browse the repository at this point in the history
* Localize the message boxes that contained hardcoded strings. 
* Create PrintErrorMsgBox() to reduce code duplication for the error messages.
* Brought to you by Lee Schroeder.
CORE-7339 #resolve #comment Committed in r61926. Cheers !

svn path=/trunk/; revision=61926
  • Loading branch information
AmineKhaldi committed Feb 2, 2014
1 parent 5c4082a commit d09f611
Show file tree
Hide file tree
Showing 22 changed files with 286 additions and 39 deletions.
26 changes: 8 additions & 18 deletions reactos/dll/cpl/intl/date.c
Expand Up @@ -104,9 +104,7 @@ SetShortDateSep(HWND hwndDlg, LCID lcid)
{
if (_istalnum(szShortDateSep[nSepCount]) || (szShortDateSep[nSepCount] == _T('\'')))
{
MessageBox(NULL,
_T("Entered short date separator contain incorrect symbol"),
_T("Error"), MB_OK | MB_ICONERROR);
PrintErrorMsgBox(IDS_ERROR_SYMBOL_SEPARATE);
return FALSE;
}
}
Expand Down Expand Up @@ -156,19 +154,15 @@ SetShortDateFormat(HWND hwndDlg, LCID lcid)
!isDateCompAl(szShortDateFmt[nDateCompCount]) &&
!OpenApostFlg)
{
MessageBox(NULL,
_T("Entered short date format contain incorrect symbol"),
_T("Error"), MB_OK | MB_ICONERROR);
PrintErrorMsgBox(IDS_ERROR_SYMBOL_FORMAT_SHORT);
return FALSE;
}

}

if (OpenApostFlg)
{
MessageBoxW(NULL,
_T("Entered short date format contain incorrect symbol"),
_T("Error"), MB_OK | MB_ICONERROR);
PrintErrorMsgBox(IDS_ERROR_SYMBOL_FORMAT_SHORT);
return FALSE;
}

Expand Down Expand Up @@ -214,19 +208,15 @@ SetLongDateFormat(HWND hwndDlg, LCID lcid)
!isDateCompAl(szLongDateFmt[nDateCompCount]) &&
!OpenApostFlg)
{
MessageBox(NULL,
_T("Entered long date format contain incorrect symbol"),
_T("Error"), MB_OK | MB_ICONERROR);
PrintErrorMsgBox(IDS_ERROR_SYMBOL_FORMAT_LONG);
return FALSE;
}

}

if (OpenApostFlg)
{
MessageBoxW(NULL,
_T("Entered long date format contain incorrect symbol"),
_T("Error"), MB_OK | MB_ICONERROR);
PrintErrorMsgBox(IDS_ERROR_SYMBOL_FORMAT_LONG);
return FALSE;
}

Expand Down Expand Up @@ -575,9 +565,9 @@ DatePageProc(HWND hwndDlg,
}
case IDC_SCR_MAX_YEAR:
{
/* Set "Apply" button enabled */
/* FIXME */
//PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
/* Set "Apply" button enabled */
/* FIXME */
//PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
break;
case IDC_CALTYPE_COMBO:
Expand Down
18 changes: 6 additions & 12 deletions reactos/dll/cpl/intl/generalp.c
Expand Up @@ -161,23 +161,21 @@ SetNewLocale(LCID lcid)
ret = GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, OEMPage, sizeof(OEMPage)/sizeof(TCHAR));
if (ret == 0)
{
MessageBox(NULL, _T("Problem reading OEM code page"), _T("Big Problem"), MB_OK);
PrintErrorMsgBox(IDS_ERROR_OEM_CODE_PAGE);
return;
}

ret = GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, ACPPage, sizeof(ACPPage)/sizeof(TCHAR));
if (ret == 0)
{
MessageBox(NULL, _T("Problem reading ANSI code page"), _T("Big Problem"), MB_OK);
PrintErrorMsgBox(IDS_ERROR_ANSI_CODE_PAGE);
return;
}

ret = RegOpenKey(HKEY_CURRENT_USER, _T("Control Panel\\International"), &localeKey);
if (ret != ERROR_SUCCESS)
{
// Some serious error
MessageBox(NULL, _T("Problem opening HKCU\\Control Panel\\International key"),
_T("Big Problem"), MB_OK);
PrintErrorMsgBox(IDS_ERROR_INT_KEY_REG);
return;
}

Expand All @@ -190,9 +188,7 @@ SetNewLocale(LCID lcid)
ret = RegOpenKey(HKEY_USERS, _T(".DEFAULT\\Control Panel\\International"), &localeKey);
if (ret != ERROR_SUCCESS)
{
// Some serious error
MessageBox(NULL, _T("Problem opening HKU\\.DEFAULT\\Control Panel\\International key"),
_T("Big Problem"), MB_OK);
PrintErrorMsgBox(IDS_ERROR_DEF_INT_KEY_REG);
return;
}

Expand All @@ -206,8 +202,7 @@ SetNewLocale(LCID lcid)
ret = RegOpenKey(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Control\\NLS\\Language"), &langKey);
if (ret != ERROR_SUCCESS)
{
MessageBoxW(NULL, _T("Problem opening HKLM\\SYSTEM\\CurrentControlSet\\Control\\NLS\\Language key"),
_T("Big Problem"), MB_OK);
PrintErrorMsgBox(IDS_ERROR_NLS_KEY_REG);
return;
}

Expand All @@ -221,8 +216,7 @@ SetNewLocale(LCID lcid)
ret = RegOpenKey(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage"), &langKey);
if (ret != ERROR_SUCCESS)
{
MessageBox(NULL, _T("Problem opening HKLM\\SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage key"),
_T("Big Problem"), MB_OK);
PrintErrorMsgBox(IDS_ERROR_NLS_CODE_REG);
return;
}

Expand Down
15 changes: 14 additions & 1 deletion reactos/dll/cpl/intl/intl.c
Expand Up @@ -29,6 +29,8 @@

#define NUM_APPLETS (1)

#define BUFFERSIZE 512

static LONG APIENTRY
Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam);

Expand All @@ -46,6 +48,17 @@ APPLET Applets[NUM_APPLETS] =
{IDC_CPLICON, IDS_CPLNAME, IDS_CPLDESCRIPTION, Applet}
};

VOID
PrintErrorMsgBox(UINT msg)
{
TCHAR szErrorText[BUFFERSIZE];
TCHAR szErrorCaption[BUFFERSIZE];

LoadString(hApplet, msg, szErrorText, sizeof(szErrorText)/sizeof(TCHAR));
LoadString(hApplet, IDS_ERROR, szErrorCaption, sizeof(szErrorCaption)/sizeof(TCHAR));

MessageBox(NULL, szErrorText, szErrorCaption, MB_OK | MB_ICONERROR);
}

static VOID
InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
Expand Down Expand Up @@ -124,7 +137,7 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
{
PROPSHEETPAGE psp[3];
PROPSHEETHEADER psh;
TCHAR Caption[256];
TCHAR Caption[BUFFERSIZE];

if (OpenSetupInf())
{
Expand Down
1 change: 1 addition & 0 deletions reactos/dll/cpl/intl/intl.h
Expand Up @@ -57,6 +57,7 @@ extern DWORD IsUnattendedSetupEnabled;
extern DWORD UnattendLCID;

/* intl.c */
VOID PrintErrorMsgBox(UINT msg);

/* languages.c */
INT_PTR CALLBACK
Expand Down
15 changes: 15 additions & 0 deletions reactos/dll/cpl/intl/lang/bg-BG.rc
Expand Up @@ -191,3 +191,18 @@ BEGIN
IDS_CPLNAME "Местни и езикови настройки"
IDS_CPLDESCRIPTION "Избор на езици и изписване на числата, валутите, времето и датата."
END

STRINGTABLE
BEGIN
IDS_ERROR "Error"
IDS_ERROR_SYMBOL_SEPARATE "Entered short date separator contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_SHORT "Entered short date format contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_LONG "Entered long date format contain incorrect symbol"
IDS_ERROR_OEM_CODE_PAGE "Problem reading OEM code page"
IDS_ERROR_ANSI_CODE_PAGE "Problem reading ANSI code page"
IDS_ERROR_INT_KEY_REG "Problem opening HKCU\\Control Panel\\International key"
IDS_ERROR_DEF_INT_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_CODE_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_INPUT_DLL "Can't start input.dll"
END
15 changes: 15 additions & 0 deletions reactos/dll/cpl/intl/lang/cs-CZ.rc
Expand Up @@ -196,3 +196,18 @@ BEGIN
IDS_CPLNAME "Místní nastavení"
IDS_CPLDESCRIPTION "Zde lze nastavit zobrazení jazyků, čísel, měn, času a dat."
END

STRINGTABLE
BEGIN
IDS_ERROR "Error"
IDS_ERROR_SYMBOL_SEPARATE "Entered short date separator contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_SHORT "Entered short date format contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_LONG "Entered long date format contain incorrect symbol"
IDS_ERROR_OEM_CODE_PAGE "Problem reading OEM code page"
IDS_ERROR_ANSI_CODE_PAGE "Problem reading ANSI code page"
IDS_ERROR_INT_KEY_REG "Problem opening HKCU\\Control Panel\\International key"
IDS_ERROR_DEF_INT_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_CODE_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_INPUT_DLL "Can't start input.dll"
END
15 changes: 15 additions & 0 deletions reactos/dll/cpl/intl/lang/de-DE.rc
Expand Up @@ -191,3 +191,18 @@ BEGIN
IDS_CPLNAME "Regionale Einstellungen"
IDS_CPLDESCRIPTION "Wählen Sie Anzeigeeinstellungen für Sprache, Zahlen, Währung, Uhrzeit und Datum aus."
END

STRINGTABLE
BEGIN
IDS_ERROR "Error"
IDS_ERROR_SYMBOL_SEPARATE "Entered short date separator contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_SHORT "Entered short date format contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_LONG "Entered long date format contain incorrect symbol"
IDS_ERROR_OEM_CODE_PAGE "Problem reading OEM code page"
IDS_ERROR_ANSI_CODE_PAGE "Problem reading ANSI code page"
IDS_ERROR_INT_KEY_REG "Problem opening HKCU\\Control Panel\\International key"
IDS_ERROR_DEF_INT_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_CODE_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_INPUT_DLL "Can't start input.dll"
END
15 changes: 15 additions & 0 deletions reactos/dll/cpl/intl/lang/en-US.rc
Expand Up @@ -191,3 +191,18 @@ BEGIN
IDS_CPLNAME "Regional Options"
IDS_CPLDESCRIPTION "Select languages and format numbers, currencies, times and date."
END

STRINGTABLE
BEGIN
IDS_ERROR "Error"
IDS_ERROR_SYMBOL_SEPARATE "Entered short date separator contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_SHORT "Entered short date format contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_LONG "Entered long date format contain incorrect symbol"
IDS_ERROR_OEM_CODE_PAGE "Problem reading OEM code page"
IDS_ERROR_ANSI_CODE_PAGE "Problem reading ANSI code page"
IDS_ERROR_INT_KEY_REG "Problem opening HKCU\\Control Panel\\International key"
IDS_ERROR_DEF_INT_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_CODE_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_INPUT_DLL "Can't start input.dll"
END
15 changes: 15 additions & 0 deletions reactos/dll/cpl/intl/lang/es-ES.rc
Expand Up @@ -193,3 +193,18 @@ BEGIN
IDS_CPLNAME "Opciones regionales"
IDS_CPLDESCRIPTION "Personaliza la configuración para mostrar idiomas, números, horas y fechas."
END

STRINGTABLE
BEGIN
IDS_ERROR "Error"
IDS_ERROR_SYMBOL_SEPARATE "Entered short date separator contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_SHORT "Entered short date format contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_LONG "Entered long date format contain incorrect symbol"
IDS_ERROR_OEM_CODE_PAGE "Problem reading OEM code page"
IDS_ERROR_ANSI_CODE_PAGE "Problem reading ANSI code page"
IDS_ERROR_INT_KEY_REG "Problem opening HKCU\\Control Panel\\International key"
IDS_ERROR_DEF_INT_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_CODE_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_INPUT_DLL "Can't start input.dll"
END
19 changes: 17 additions & 2 deletions reactos/dll/cpl/intl/lang/fr-FR.rc
Expand Up @@ -190,6 +190,21 @@ END

STRINGTABLE
BEGIN
IDS_CPLNAME "Options régionales"
IDS_CPLDESCRIPTION "Sélectionner les langues, les formats de nombres, les monnaies, l'heure et la date."
IDS_CPLNAME "Options régionales"
IDS_CPLDESCRIPTION "Sélectionner les langues, les formats de nombres, les monnaies, l'heure et la date."
END

STRINGTABLE
BEGIN
IDS_ERROR "Error"
IDS_ERROR_SYMBOL_SEPARATE "Entered short date separator contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_SHORT "Entered short date format contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_LONG "Entered long date format contain incorrect symbol"
IDS_ERROR_OEM_CODE_PAGE "Problem reading OEM code page"
IDS_ERROR_ANSI_CODE_PAGE "Problem reading ANSI code page"
IDS_ERROR_INT_KEY_REG "Problem opening HKCU\\Control Panel\\International key"
IDS_ERROR_DEF_INT_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_CODE_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_INPUT_DLL "Can't start input.dll"
END
15 changes: 15 additions & 0 deletions reactos/dll/cpl/intl/lang/he-IL.rc
Expand Up @@ -193,3 +193,18 @@ BEGIN
IDS_CPLNAME "אפשרויות אזוריות"
IDS_CPLDESCRIPTION "Select languages and format numbers, currencies, times and date."
END

STRINGTABLE
BEGIN
IDS_ERROR "Error"
IDS_ERROR_SYMBOL_SEPARATE "Entered short date separator contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_SHORT "Entered short date format contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_LONG "Entered long date format contain incorrect symbol"
IDS_ERROR_OEM_CODE_PAGE "Problem reading OEM code page"
IDS_ERROR_ANSI_CODE_PAGE "Problem reading ANSI code page"
IDS_ERROR_INT_KEY_REG "Problem opening HKCU\\Control Panel\\International key"
IDS_ERROR_DEF_INT_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_CODE_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_INPUT_DLL "Can't start input.dll"
END
15 changes: 15 additions & 0 deletions reactos/dll/cpl/intl/lang/it-IT.rc
Expand Up @@ -193,3 +193,18 @@ BEGIN
IDS_CPLNAME "Opzioni internazionali e della lingua"
IDS_CPLDESCRIPTION "Personalizza le impostazioni per la visualizzazione delle lingue, numeri, ora e data."
END

STRINGTABLE
BEGIN
IDS_ERROR "Error"
IDS_ERROR_SYMBOL_SEPARATE "Entered short date separator contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_SHORT "Entered short date format contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_LONG "Entered long date format contain incorrect symbol"
IDS_ERROR_OEM_CODE_PAGE "Problem reading OEM code page"
IDS_ERROR_ANSI_CODE_PAGE "Problem reading ANSI code page"
IDS_ERROR_INT_KEY_REG "Problem opening HKCU\\Control Panel\\International key"
IDS_ERROR_DEF_INT_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_CODE_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_INPUT_DLL "Can't start input.dll"
END
15 changes: 15 additions & 0 deletions reactos/dll/cpl/intl/lang/no-NO.rc
Expand Up @@ -191,3 +191,18 @@ BEGIN
IDS_CPLNAME "Regionale innstillinger"
IDS_CPLDESCRIPTION "Velg språk og nummer format, valuta, tid og dato."
END

STRINGTABLE
BEGIN
IDS_ERROR "Error"
IDS_ERROR_SYMBOL_SEPARATE "Entered short date separator contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_SHORT "Entered short date format contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_LONG "Entered long date format contain incorrect symbol"
IDS_ERROR_OEM_CODE_PAGE "Problem reading OEM code page"
IDS_ERROR_ANSI_CODE_PAGE "Problem reading ANSI code page"
IDS_ERROR_INT_KEY_REG "Problem opening HKCU\\Control Panel\\International key"
IDS_ERROR_DEF_INT_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_CODE_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_INPUT_DLL "Can't start input.dll"
END
15 changes: 15 additions & 0 deletions reactos/dll/cpl/intl/lang/pl-PL.rc
Expand Up @@ -199,3 +199,18 @@ BEGIN
IDS_CPLNAME "Ustawienia regionalne"
IDS_CPLDESCRIPTION "Ustawienia języków oraz formaty liczb, walut, daty i czasu."
END

STRINGTABLE
BEGIN
IDS_ERROR "Error"
IDS_ERROR_SYMBOL_SEPARATE "Entered short date separator contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_SHORT "Entered short date format contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_LONG "Entered long date format contain incorrect symbol"
IDS_ERROR_OEM_CODE_PAGE "Problem reading OEM code page"
IDS_ERROR_ANSI_CODE_PAGE "Problem reading ANSI code page"
IDS_ERROR_INT_KEY_REG "Problem opening HKCU\\Control Panel\\International key"
IDS_ERROR_DEF_INT_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_CODE_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_INPUT_DLL "Can't start input.dll"
END
19 changes: 17 additions & 2 deletions reactos/dll/cpl/intl/lang/ro-RO.rc
Expand Up @@ -190,6 +190,21 @@ END

STRINGTABLE
BEGIN
IDS_CPLNAME "Opțiuni regionale"
IDS_CPLDESCRIPTION "Configurarea limbii și formatarea numerelor, valutelor, datei și orei."
IDS_CPLNAME "Opțiuni regionale"
IDS_CPLDESCRIPTION "Configurarea limbii și formatarea numerelor, valutelor, datei și orei."
END

STRINGTABLE
BEGIN
IDS_ERROR "Error"
IDS_ERROR_SYMBOL_SEPARATE "Entered short date separator contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_SHORT "Entered short date format contain incorrect symbol"
IDS_ERROR_SYMBOL_FORMAT_LONG "Entered long date format contain incorrect symbol"
IDS_ERROR_OEM_CODE_PAGE "Problem reading OEM code page"
IDS_ERROR_ANSI_CODE_PAGE "Problem reading ANSI code page"
IDS_ERROR_INT_KEY_REG "Problem opening HKCU\\Control Panel\\International key"
IDS_ERROR_DEF_INT_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_KEY_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_NLS_CODE_REG "Problem opening HKU\\.DEFAULT\\Control Panel\\International key"
IDS_ERROR_INPUT_DLL "Can't start input.dll"
END

0 comments on commit d09f611

Please sign in to comment.