- Show localized error messages

svn path=/trunk/; revision=31563
This commit is contained in:
Marc Piulachs 2008-01-02 14:34:51 +00:00
parent 09b813c184
commit eae9ec5c8f
4 changed files with 122 additions and 51 deletions

View file

@ -1,6 +1,31 @@
#ifndef ERROR_CODE_H__ /*
#define ERROR_CODE_H__ * ReactOS kernel
* Copyright (C) 2003 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: registry.h 21704 2006-04-22 13:55:01Z tretiakov $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/errcode.h
* PURPOSE:
* PROGRAMMER:
*/
#ifndef __ERROR_CODE_H__
#define __ERROR_CODE_H__
typedef enum typedef enum
{ {
@ -41,16 +66,7 @@ typedef enum
ERROR_LAST_ERROR_CODE ERROR_LAST_ERROR_CODE
}ERROR_NUMBER; }ERROR_NUMBER;
typedef struct #endif /* __ERROR_CODE_H__ */
{
CHAR * ErrorText;
CHAR * ErrorStatus;
}MUI_ERROR;
/* EOF */
VOID
MUIDisplayError(ULONG ErrorNum, PINPUT_RECORD Ir, ULONG WaitEvent);
#endif

View file

@ -1244,9 +1244,9 @@ MUI_ERROR esESErrorEntries[] =
"computer. If you quit Setup now, you will need to\n" "computer. If you quit Setup now, you will need to\n"
"run Setup again to install ReactOS.\n" "run Setup again to install ReactOS.\n"
"\n" "\n"
" \x07 Press ENTER to continue Setup.\n" " \x07 Presione ENTER para continuar el Setup.\n"
" \x07 Press F3 to quit Setup.", " \x07 Presione F3 para abandonar el Setup.",
"F3= Quit ENTER = Continue" "F3 = Salir ENTER = Continuar"
}, },
{ {
//ERROR_NO_HDD //ERROR_NO_HDD
@ -1527,3 +1527,4 @@ MUI_PAGE esESPages[] =
#endif #endif

View file

@ -44,55 +44,64 @@ static MUI_LANGUAGE LanguageList[] =
L"00000409", /* The Language ID */ L"00000409", /* The Language ID */
L"00000409", /* Default Keyboard Layout for this language */ L"00000409", /* Default Keyboard Layout for this language */
L"English", /* Language Name , not used just to make things easier when updating this file */ L"English", /* Language Name , not used just to make things easier when updating this file */
enUSPages /* Translated strings */ enUSPages, /* Translated page strings */
enUSErrorEntries /* Translated error strings */
}, },
{ {
L"0000040C", L"0000040C",
L"0000040C", L"0000040C",
L"French", L"French",
frFRPages frFRPages,
frFRErrorEntries
}, },
{ {
L"00000407", L"00000407",
L"00000407", L"00000407",
L"German", L"German",
deDEPages deDEPages,
deDEErrorEntries
}, },
{ {
L"00000408", L"00000408",
L"00000409", L"00000409",
L"Greek", L"Greek",
elGRPages elGRPages,
elGRErrorEntries
}, },
{ {
L"00000410", L"00000410",
L"00000410", L"00000410",
L"Italian", L"Italian",
itITPages itITPages,
itITErrorEntries
}, },
{ {
L"00000419", L"00000419",
L"00000419", L"00000419",
L"Russian", L"Russian",
ruRUPages ruRUPages,
ruRUErrorEntries
}, },
{ {
L"0000040A", L"0000040A",
L"0000040A", L"0000040A",
L"Spanish", L"Spanish",
esESPages esESPages,
esESErrorEntries
}, },
{ {
L"0000041D", L"0000041D",
L"0000041D", L"0000041D",
L"Swedish", L"Swedish",
svSEPages svSEPages,
svSEErrorEntries
}, },
{ {
L"00000422", L"00000422",
L"00000422", L"00000422",
L"Ukrainian", L"Ukrainian",
ukUAPages ukUAPages,
ukUAErrorEntries
}, },
{ {
NULL, NULL,
@ -142,6 +151,28 @@ FindMUIEntriesOfPage (ULONG PageNumber)
return NULL; return NULL;
} }
static
MUI_ERROR *
FindMUIErrorEntries ()
{
ULONG lngIndex = 0;
do
{
/* First we search the language list till we find current selected language messages */
if (_wcsicmp(LanguageList[lngIndex].LanguageID , SelectedLanguageId) == 0)
{
/* Get all available error messages for this language */
return LanguageList[lngIndex].MuiErrors;
}
lngIndex++;
}
while (LanguageList[lngIndex].MuiPages != NULL);
return NULL;
}
VOID VOID
MUIDisplayPage(ULONG page) MUIDisplayPage(ULONG page)
{ {
@ -188,18 +219,30 @@ MUIDisplayPage(ULONG page)
VOID VOID
MUIDisplayError(ULONG ErrorNum, PINPUT_RECORD Ir, ULONG WaitEvent) MUIDisplayError(ULONG ErrorNum, PINPUT_RECORD Ir, ULONG WaitEvent)
{ {
MUI_ERROR * entry;
if (ErrorNum >= ERROR_LAST_ERROR_CODE) if (ErrorNum >= ERROR_LAST_ERROR_CODE)
{ {
PopupError("invalid error number provided", PopupError("Pnvalid error number provided",
"press enter to continue", "Press ENTER to continue",
Ir, Ir,
POPUP_WAIT_ENTER); POPUP_WAIT_ENTER);
return; return;
} }
PopupError(enUSErrorEntries[ErrorNum].ErrorText, entry = FindMUIErrorEntries ();
enUSErrorEntries[ErrorNum].ErrorStatus, if (!entry)
{
PopupError("Error: Failed to find translated error message",
NULL,
NULL,
POPUP_WAIT_NONE);
return;
}
PopupError(entry[ErrorNum].ErrorText,
entry[ErrorNum].ErrorStatus,
Ir, Ir,
WaitEvent); WaitEvent);
} }

View file

@ -9,6 +9,12 @@ typedef struct
BYTE Flags; BYTE Flags;
}MUI_ENTRY, *PMUI_ENTRY; }MUI_ENTRY, *PMUI_ENTRY;
typedef struct
{
CHAR * ErrorText;
CHAR * ErrorStatus;
}MUI_ERROR;
typedef struct typedef struct
{ {
long Number; long Number;
@ -21,19 +27,24 @@ typedef struct
PWCHAR LanguageKeyboardLayoutID; PWCHAR LanguageKeyboardLayoutID;
PWCHAR LanguageDescriptor; PWCHAR LanguageDescriptor;
MUI_PAGE * MuiPages; MUI_PAGE * MuiPages;
MUI_ERROR * MuiErrors;
}MUI_LANGUAGE; }MUI_LANGUAGE;
#define TEXT_NORMAL 0 #define TEXT_NORMAL 0
#define TEXT_HIGHLIGHT 1 #define TEXT_HIGHLIGHT 1
#define TEXT_UNDERLINE 2 #define TEXT_UNDERLINE 2
#define TEXT_STATUS 4 #define TEXT_STATUS 4
#define TEXT_ALIGN_DEFAULT 5 #define TEXT_ALIGN_DEFAULT 8
#define TEXT_ALIGN_RIGHT 6 #define TEXT_ALIGN_RIGHT 16
#define TEXT_ALIGN_LEFT 7 #define TEXT_ALIGN_LEFT 32
#define TEXT_ALIGN_CENTER 8 #define TEXT_ALIGN_CENTER 64
VOID VOID
MUIDisplayPage (ULONG PageNumber); MUIDisplayPage (ULONG PageNumber);
VOID
MUIDisplayError (ULONG ErrorNum, PINPUT_RECORD Ir, ULONG WaitEvent);
#endif #endif