- 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
{
@ -41,16 +66,7 @@ typedef enum
ERROR_LAST_ERROR_CODE
}ERROR_NUMBER;
typedef struct
{
CHAR * ErrorText;
CHAR * ErrorStatus;
}MUI_ERROR;
#endif /* __ERROR_CODE_H__ */
/* EOF */
VOID
MUIDisplayError(ULONG ErrorNum, PINPUT_RECORD Ir, ULONG WaitEvent);
#endif

View file

@ -1241,12 +1241,12 @@ MUI_ERROR esESErrorEntries[] =
{
//ERROR_NOT_INSTALLED
"ReactOS is not completely installed on your\n"
"computer. If you quit Setup now, you will need to\n"
"run Setup again to install ReactOS.\n"
"\n"
" \x07 Press ENTER to continue Setup.\n"
" \x07 Press F3 to quit Setup.",
"F3= Quit ENTER = Continue"
"computer. If you quit Setup now, you will need to\n"
"run Setup again to install ReactOS.\n"
"\n"
" \x07 Presione ENTER para continuar el Setup.\n"
" \x07 Presione F3 para abandonar el Setup.",
"F3 = Salir ENTER = Continuar"
},
{
//ERROR_NO_HDD
@ -1305,14 +1305,14 @@ MUI_ERROR esESErrorEntries[] =
},
{
//ERROR_WARN_PARTITION,
"Setup found that at least one harddisk contains an incompatible\n"
"partition table that can not be handled properly!\n"
"\n"
"Creating or deleting partitions can destroy the partiton table.\n"
"\n"
" \x07 Press F3 to quit Setup."
" \x07 Press ENTER to continue.",
"F3= Quit ENTER = Continue"
"Setup found that at least one harddisk contains an incompatible\n"
"partition table that can not be handled properly!\n"
"\n"
"Creating or deleting partitions can destroy the partiton table.\n"
"\n"
" \x07 Press F3 to quit Setup."
" \x07 Press ENTER to continue.",
"F3= Quit ENTER = Continue"
},
{
//ERROR_NEW_PARTITION,
@ -1414,8 +1414,8 @@ MUI_ERROR esESErrorEntries[] =
{
//ERROR_FIND_SETUPDATA,
"Setup failed to find the 'SetupData' section\n"
"in TXTSETUP.SIF.\n",
"ENTER = Reboot computer"
"in TXTSETUP.SIF.\n",
"ENTER = Reboot computer"
},
{
//ERROR_WRITE_PTABLE,
@ -1527,3 +1527,4 @@ MUI_PAGE esESPages[] =
#endif

View file

@ -41,58 +41,67 @@
static MUI_LANGUAGE LanguageList[] =
{
{
L"00000409", /* The Language ID */
L"00000409", /* Default Keyboard Layout for this language */
L"English", /* Language Name , not used just to make things easier when updating this file */
enUSPages /* Translated strings */
L"00000409", /* The Language ID */
L"00000409", /* Default Keyboard Layout for this language */
L"English", /* Language Name , not used just to make things easier when updating this file */
enUSPages, /* Translated page strings */
enUSErrorEntries /* Translated error strings */
},
{
L"0000040C",
L"0000040C",
L"French",
frFRPages
frFRPages,
frFRErrorEntries
},
{
L"00000407",
L"00000407",
L"German",
deDEPages
deDEPages,
deDEErrorEntries
},
{
L"00000408",
L"00000409",
L"Greek",
elGRPages
elGRPages,
elGRErrorEntries
},
{
L"00000410",
L"00000410",
L"Italian",
itITPages
itITPages,
itITErrorEntries
},
{
L"00000419",
L"00000419",
L"Russian",
ruRUPages
ruRUPages,
ruRUErrorEntries
},
{
L"0000040A",
L"0000040A",
L"Spanish",
esESPages
esESPages,
esESErrorEntries
},
{
L"0000041D",
L"0000041D",
L"Swedish",
svSEPages
svSEPages,
svSEErrorEntries
},
{
L"00000422",
L"00000422",
L"Ukrainian",
ukUAPages
ukUAPages,
ukUAErrorEntries
},
{
NULL,
@ -142,6 +151,28 @@ FindMUIEntriesOfPage (ULONG PageNumber)
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
MUIDisplayPage(ULONG page)
{
@ -188,18 +219,30 @@ MUIDisplayPage(ULONG page)
VOID
MUIDisplayError(ULONG ErrorNum, PINPUT_RECORD Ir, ULONG WaitEvent)
{
MUI_ERROR * entry;
if (ErrorNum >= ERROR_LAST_ERROR_CODE)
{
PopupError("invalid error number provided",
"press enter to continue",
Ir,
POPUP_WAIT_ENTER);
PopupError("Pnvalid error number provided",
"Press ENTER to continue",
Ir,
POPUP_WAIT_ENTER);
return;
}
PopupError(enUSErrorEntries[ErrorNum].ErrorText,
enUSErrorEntries[ErrorNum].ErrorStatus,
entry = FindMUIErrorEntries ();
if (!entry)
{
PopupError("Error: Failed to find translated error message",
NULL,
NULL,
POPUP_WAIT_NONE);
return;
}
PopupError(entry[ErrorNum].ErrorText,
entry[ErrorNum].ErrorStatus,
Ir,
WaitEvent);
}

View file

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