Author: tkreuzer
Date: Fri Feb 8 07:14:09 2008
New Revision: 32204
URL:
http://svn.reactos.org/svn/reactos?rev=32204&view=rev
Log:
- allow translation of strings in usetup
- so far most strings are still hardcoded, but the needed functionality is in place
Modified:
trunk/reactos/base/setup/usetup/interface/usetup.c
trunk/reactos/base/setup/usetup/lang/de-DE.h
trunk/reactos/base/setup/usetup/lang/en-US.h
trunk/reactos/base/setup/usetup/mui.c
trunk/reactos/base/setup/usetup/mui.h
Modified: trunk/reactos/base/setup/usetup/interface/usetup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/interfac…
==============================================================================
--- trunk/reactos/base/setup/usetup/interface/usetup.c (original)
+++ trunk/reactos/base/setup/usetup/interface/usetup.c Fri Feb 8 07:14:09 2008
@@ -1370,11 +1370,11 @@
if (PartitionList->CurrentPartition == NULL ||
PartitionList->CurrentPartition->Unpartitioned == TRUE)
{
- CONSOLE_SetStatusText (" ENTER = Install C = Create Partition F3 =
Quit");
+ CONSOLE_SetStatusText (MUIGetString(STRING_INSTALLCREATEPARTITION));
}
else
{
- CONSOLE_SetStatusText (" ENTER = Install D = Delete Partition F3 =
Quit");
+ CONSOLE_SetStatusText (MUIGetString(STRING_INSTALLDELETEPARTITION));
}
CONSOLE_ConInKey(Ir);
@@ -1495,7 +1495,7 @@
/* Print message */
coPos.X = Left + 2;
coPos.Y = Top + 2;
- strcpy (Buffer, "Size of new partition:");
+ strcpy (Buffer, MUIGetString(STRING_PARTITIONSIZE));
iLeft = coPos.X + strlen (Buffer) + 1;
iTop = coPos.Y;
@@ -1604,9 +1604,9 @@
DiskEntry = PartitionList->CurrentDisk;
PartEntry = PartitionList->CurrentPartition;
- CONSOLE_SetStatusText (" Please wait...");
-
- CONSOLE_SetTextXY (6, 8, "You have chosen to create a new partition on");
+ CONSOLE_SetStatusText (MUIGetString(STRING_PLEASEWAIT));
+
+ CONSOLE_SetTextXY (6, 8, MUIGetString(STRING_CHOOSENEWPARTITION));
#if 0
if (DiskEntry->DiskSize >= 0x280000000ULL) /* 10 GB */
@@ -1656,7 +1656,7 @@
PartitionList->CurrentPartition->UnpartitionedLength /
(1024*1024));
#endif
- CONSOLE_SetStatusText (" ENTER = Create Partition ESC = Cancel F3 =
Quit");
+ CONSOLE_SetStatusText (MUIGetString(STRING_CREATEPARTITION));
PartEntry = PartitionList->CurrentPartition;
while (TRUE)
@@ -2785,7 +2785,7 @@
{
MUIDisplayError(ERROR_TXTSETUP_SECTION, Ir, POPUP_WAIT_ENTER);
}
-
+
return FALSE;
}
@@ -2979,7 +2979,7 @@
case SPFILENOTIFY_STARTCOPY:
/* Display copy message */
- CONSOLE_SetStatusText("
\xB3 Copying file: %S", (PWSTR)Param1);
+ CONSOLE_SetStatusText(MUIGetString(STRING_COPYING), (PWSTR)Param1);
SetupUpdateMemoryInfo(CopyContext, FALSE);
break;
@@ -3015,7 +3015,7 @@
10,
24,
TRUE,
- "Setup is copying files...");
+ MUIGetString(STRING_SETUPCOPYINGFILES));
/* Create the paged pool progress bar */
CopyContext.MemoryBars[0] = CreateProgressBar(13,
@@ -3025,7 +3025,7 @@
10,
44,
FALSE,
- "Paged Memory");
+ MUIGetString(STRING_PAGEDMEM));
/* Create the non paged pool progress bar */
CopyContext.MemoryBars[1] = CreateProgressBar(28,
@@ -3035,7 +3035,7 @@
24,
44,
FALSE,
- "Nonpaged Memory");
+ MUIGetString(STRING_NONPAGEDMEM));
/* Create the global memory progress bar */
CopyContext.MemoryBars[2] = CreateProgressBar(43,
@@ -3045,7 +3045,7 @@
40,
44,
FALSE,
- "Free Memory");
+ MUIGetString(STRING_FREEMEM));
/* Do the file copying */
SetupCommitFileQueueW(NULL,
Modified: trunk/reactos/base/setup/usetup/lang/de-DE.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/lang/de-…
==============================================================================
--- trunk/reactos/base/setup/usetup/lang/de-DE.h (original)
+++ trunk/reactos/base/setup/usetup/lang/de-DE.h Fri Feb 8 07:14:09 2008
@@ -1574,4 +1574,31 @@
}
};
+MUI_STRING deDEStrings[] =
+{
+ {STRING_INSTALLCREATEPARTITION,
+ " ENTER = Installieren C = Partition erstellen F3 = Beenden"},
+ {STRING_INSTALLDELETEPARTITION,
+ " ENTER = Installieren D = Partition löschen F3 = Beenden"},
+ {STRING_PARTITIONSIZE,
+ "Größe der neuen Partition:"},
+ {STRING_PLEASEWAIT,
+ " Bitte warten..."},
+ {STRING_CHOOSENEWPARTITION,
+ "Sie haben beschlossen eine neue Partition zu erstellen auf"},
+ {STRING_CREATEPARTITION,
+ " ENTER = Partition erstelln ESC = Abbruch F3 = Beenden"},
+ {STRING_COPYING,
+ " \xB3 Kopiere Datei:
%S"},
+ {STRING_SETUPCOPYINGFILES,
+ "Setup kopiert Dateien..."},
+ {STRING_PAGEDMEM,
+ "Paged Memory"},
+ {STRING_NONPAGEDMEM,
+ "Nonpaged Memory"},
+ {STRING_FREEMEM,
+ "Free Memory"},
+ {0, 0}
+};
+
#endif
Modified: trunk/reactos/base/setup/usetup/lang/en-US.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/lang/en-…
==============================================================================
--- trunk/reactos/base/setup/usetup/lang/en-US.h (original)
+++ trunk/reactos/base/setup/usetup/lang/en-US.h Fri Feb 8 07:14:09 2008
@@ -1568,4 +1568,31 @@
}
};
+MUI_STRING enUSStrings[] =
+{
+ {STRING_INSTALLCREATEPARTITION,
+ " ENTER = Install C = Create Partition F3 = Quit"},
+ {STRING_INSTALLDELETEPARTITION,
+ " ENTER = Install D = Delete Partition F3 = Quit"},
+ {STRING_PARTITIONSIZE,
+ "Size of new partition:"},
+ {STRING_PLEASEWAIT,
+ " Please wait..."},
+ {STRING_CHOOSENEWPARTITION,
+ "You have chosen to create a new partition on"},
+ {STRING_CREATEPARTITION,
+ " ENTER = Create Partition ESC = Cancel F3 = Quit"},
+ {STRING_COPYING,
+ " \xB3 Copying file:
%S"},
+ {STRING_SETUPCOPYINGFILES,
+ "Setup is copying files..."},
+ {STRING_PAGEDMEM,
+ "Paged Memory"},
+ {STRING_NONPAGEDMEM,
+ "Nonpaged Memory"},
+ {STRING_FREEMEM,
+ "Free Memory"},
+ {0, 0}
+};
+
#endif
Modified: trunk/reactos/base/setup/usetup/mui.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/mui.c?re…
==============================================================================
--- trunk/reactos/base/setup/usetup/mui.c (original)
+++ trunk/reactos/base/setup/usetup/mui.c Fri Feb 8 07:14:09 2008
@@ -21,7 +21,7 @@
* PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/mui.c
* PURPOSE: Text-mode setup
- * PROGRAMMER:
+ * PROGRAMMER:
*/
#include "usetup.h"
@@ -48,32 +48,32 @@
static const MUI_LANGUAGE LanguageList[] =
{
/* Lang ID, DefKbdLayout,ANSI CP, OEM CP, MAC CP, Language Name, page
strgs,error strings */
- {L"00000409", L"00000409", L"1252", L"437",
L"10000", L"English", enUSPages, enUSErrorEntries },
- {L"00000402", L"00000402", L"1251", L"866",
L"10007", L"Bulgarian", bgBGPages, bgBGErrorEntries },
- {L"00000403", L"00000403", L"1252", L"850",
L"10000", L"Catalan", enUSPages, enUSErrorEntries },
- {L"00000804", L"00000804", L"936", L"936",
L"10008", L"Chinese (PRC)", enUSPages, enUSErrorEntries },
- {L"00000406", L"00000406", L"1252", L"850",
L"10000", L"Danish", enUSPages, enUSErrorEntries },
- {L"00000413", L"00000813", L"1252", L"850",
L"10000", L"Dutch", enUSPages, enUSErrorEntries },
- {L"0000040B", L"0000040B", L"1252", L"850",
L"10000", L"Finnish", enUSPages, enUSErrorEntries },
- {L"0000040C", L"0000040C", L"1252", L"850",
L"10000", L"French", frFRPages, frFRErrorEntries },
- {L"00000407", L"00000407", L"1252", L"850",
L"10000", L"German", deDEPages, deDEErrorEntries },
- {L"00000408", L"00000408", L"1253", L"737",
L"10006", L"Greek", elGRPages, elGRErrorEntries },
- {L"0000040D", L"0000040D", L"1255", L"862",
L"10005", L"Hebrew", enUSPages, enUSErrorEntries },
- {L"0000040E", L"0000040E", L"1250", L"852",
L"10029", L"Hungarian", enUSPages, enUSErrorEntries },
- {L"00000410", L"00000410", L"1252", L"850",
L"10000", L"Italian", itITPages, itITErrorEntries },
- {L"00000411", L"00000411", L"932", L"932",
L"10001", L"Japanese", enUSPages, enUSErrorEntries },
- {L"00000412", L"00000412", L"949", L"949",
L"10003", L"Korean", enUSPages, enUSErrorEntries },
- {L"00000427", L"00000427", L"1257", L"775",
L"10029", L"Lithuanian", ltLTPages, ltLTErrorEntries },
- {L"00000414", L"00000414", L"1252", L"850",
L"10000", L"Norwegian", enUSPages, enUSErrorEntries },
- {L"00000419", L"00000419", L"1251", L"866",
L"10007", L"Russian", ruRUPages, ruRUErrorEntries },
- {L"0000041B", L"0000041B", L"1250", L"852",
L"10029", L"Slovak", skSKPages, skSKErrorEntries },
- {L"0000040A", L"0000040A", L"1252", L"850",
L"10000", L"Spanish", esESPages, esESErrorEntries },
- {L"00000415", L"00000415", L"1250", L"852",
L"10029", L"Polish", plPLPages, plPLErrorEntries },
- {L"00000816", L"00000816", L"1252", L"850",
L"10000", L"Portuguese", enUSPages, enUSErrorEntries },
- {L"0000041D", L"0000041D", L"1252", L"850",
L"10000", L"Swedish", svSEPages, svSEErrorEntries },
- {L"0000041E", L"0000041E", L"874", L"874",
L"10021", L"Thai", enUSPages, enUSErrorEntries },
- {L"0000041F", L"0000041F", L"1254", L"857",
L"10081", L"Turkish", enUSPages, enUSErrorEntries },
- {L"00000422", L"00000422", L"1251", L"866",
L"10017", L"Ukrainian", ukUAPages, ukUAErrorEntries },
+ {L"00000409", L"00000409", L"1252", L"437",
L"10000", L"English", enUSPages, enUSErrorEntries, enUSStrings
},
+ {L"00000402", L"00000402", L"1251", L"866",
L"10007", L"Bulgarian", bgBGPages, bgBGErrorEntries, enUSStrings
},
+ {L"00000403", L"00000403", L"1252", L"850",
L"10000", L"Catalan", enUSPages, enUSErrorEntries, enUSStrings
},
+ {L"00000804", L"00000804", L"936", L"936",
L"10008", L"Chinese (PRC)", enUSPages, enUSErrorEntries, enUSStrings
},
+ {L"00000406", L"00000406", L"1252", L"850",
L"10000", L"Danish", enUSPages, enUSErrorEntries, enUSStrings
},
+ {L"00000413", L"00000813", L"1252", L"850",
L"10000", L"Dutch", enUSPages, enUSErrorEntries, enUSStrings
},
+ {L"0000040B", L"0000040B", L"1252", L"850",
L"10000", L"Finnish", enUSPages, enUSErrorEntries, enUSStrings
},
+ {L"0000040C", L"0000040C", L"1252", L"850",
L"10000", L"French", frFRPages, frFRErrorEntries, enUSStrings
},
+ {L"00000407", L"00000407", L"1252", L"850",
L"10000", L"German", deDEPages, deDEErrorEntries, deDEStrings
},
+ {L"00000408", L"00000408", L"1253", L"737",
L"10006", L"Greek", elGRPages, elGRErrorEntries, enUSStrings
},
+ {L"0000040D", L"0000040D", L"1255", L"862",
L"10005", L"Hebrew", enUSPages, enUSErrorEntries, enUSStrings
},
+ {L"0000040E", L"0000040E", L"1250", L"852",
L"10029", L"Hungarian", enUSPages, enUSErrorEntries, enUSStrings
},
+ {L"00000410", L"00000410", L"1252", L"850",
L"10000", L"Italian", itITPages, itITErrorEntries, enUSStrings
},
+ {L"00000411", L"00000411", L"932", L"932",
L"10001", L"Japanese", enUSPages, enUSErrorEntries, enUSStrings
},
+ {L"00000412", L"00000412", L"949", L"949",
L"10003", L"Korean", enUSPages, enUSErrorEntries, enUSStrings
},
+ {L"00000427", L"00000427", L"1257", L"775",
L"10029", L"Lithuanian", ltLTPages, ltLTErrorEntries, enUSStrings
},
+ {L"00000414", L"00000414", L"1252", L"850",
L"10000", L"Norwegian", enUSPages, enUSErrorEntries, enUSStrings
},
+ {L"00000419", L"00000419", L"1251", L"866",
L"10007", L"Russian", ruRUPages, ruRUErrorEntries, enUSStrings
},
+ {L"0000041B", L"0000041B", L"1250", L"852",
L"10029", L"Slovak", skSKPages, skSKErrorEntries, enUSStrings
},
+ {L"0000040A", L"0000040A", L"1252", L"850",
L"10000", L"Spanish", esESPages, esESErrorEntries, enUSStrings
},
+ {L"00000415", L"00000415", L"1250", L"852",
L"10029", L"Polish", plPLPages, plPLErrorEntries, enUSStrings
},
+ {L"00000816", L"00000816", L"1252", L"850",
L"10000", L"Portuguese", enUSPages, enUSErrorEntries, enUSStrings
},
+ {L"0000041D", L"0000041D", L"1252", L"850",
L"10000", L"Swedish", svSEPages, svSEErrorEntries, enUSStrings
},
+ {L"0000041E", L"0000041E", L"874", L"874",
L"10021", L"Thai", enUSPages, enUSErrorEntries, enUSStrings
},
+ {L"0000041F", L"0000041F", L"1254", L"857",
L"10081", L"Turkish", enUSPages, enUSErrorEntries, enUSStrings
},
+ {L"00000422", L"00000422", L"1251", L"866",
L"10017", L"Ukrainian", ukUAPages, ukUAErrorEntries, enUSStrings
},
{NULL, NULL, NULL, NULL, NULL}
};
@@ -131,6 +131,28 @@
{
/* Get all available error messages for this language */
return LanguageList[lngIndex].MuiErrors;
+ }
+
+ lngIndex++;
+ }
+ while (LanguageList[lngIndex].MuiPages != NULL);
+
+ return NULL;
+}
+
+static
+const MUI_STRING *
+FindMUIStringEntries(VOID)
+{
+ 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 strings for this language */
+ return LanguageList[lngIndex].MuiStrings;
}
lngIndex++;
@@ -234,6 +256,32 @@
WaitEvent);
}
+LPSTR
+MUIGetString(ULONG Number)
+{
+ ULONG i;
+ const MUI_STRING * entry;
+
+ entry = FindMUIStringEntries();
+ if (entry)
+ {
+ for (i = 0; entry[i].Number != 0; i++)
+ {
+ if (entry[i].Number == Number)
+ {
+ return entry[i].String;
+ }
+ }
+ }
+
+ PopupError("Error: Failed to find translated string",
+ NULL,
+ NULL,
+ POPUP_WAIT_NONE);
+
+ return "<nostring>";
+}
+
static BOOLEAN
AddCodepageToRegistry(IN LPCWSTR ACPage, IN LPCWSTR OEMCPage, IN LPCWSTR MACCPage)
{
Modified: trunk/reactos/base/setup/usetup/mui.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/mui.h?re…
==============================================================================
--- trunk/reactos/base/setup/usetup/mui.h (original)
+++ trunk/reactos/base/setup/usetup/mui.h Fri Feb 8 07:14:09 2008
@@ -23,6 +23,12 @@
typedef struct
{
+ LONG Number;
+ LPSTR String;
+} MUI_STRING;
+
+typedef struct
+{
PWCHAR LanguageID;
PWCHAR LanguageKeyboardLayoutID;
PWCHAR ACPage;
@@ -31,6 +37,7 @@
PWCHAR LanguageDescriptor;
const MUI_PAGE * MuiPages;
const MUI_ERROR * MuiErrors;
+ const MUI_STRING * MuiStrings;
}MUI_LANGUAGE;
@@ -59,4 +66,20 @@
VOID
SetConsoleCodePage(VOID);
+LPSTR
+MUIGetString(ULONG Number);
+
+#define STRING_INSTALLCREATEPARTITION 1
+#define STRING_INSTALLDELETEPARTITION 2
+#define STRING_CREATEPARTITION 3
+#define STRING_PARTITIONSIZE 4
+#define STRING_PLEASEWAIT 5
+#define STRING_CHOOSENEWPARTITION 6
+#define STRING_COPYING 7
+#define STRING_SETUPCOPYINGFILES 8
+#define STRING_PAGEDMEM 9
+#define STRING_NONPAGEDMEM 10
+#define STRING_FREEMEM 11
+
+
#endif