Remove all hardcode string from format to En.rc
so it can be translate
Added: trunk/reactos/subsys/system/format/En.rc
Modified: trunk/reactos/subsys/system/format/format.c
Modified: trunk/reactos/subsys/system/format/format.rc
Added: trunk/reactos/subsys/system/format/resource.h
_____
Added: trunk/reactos/subsys/system/format/En.rc
--- trunk/reactos/subsys/system/format/En.rc 2005-05-08 22:02:16 UTC
(rev 15156)
+++ trunk/reactos/subsys/system/format/En.rc 2005-05-09 00:05:15 UTC
(rev 15157)
@@ -0,0 +1,72 @@
+#include "resource.h"
+/*
+ * Moved all hardcoded strings to En.rc.
+ * By Magnus Olsen 2005
+ */
+
+LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
+STRINGTABLE DISCARDABLE
+{
+STRING_HELP, "Usage: %S drive: [-FS:file-system] [-V:label] [-Q]
[-A:size] [-C]\n\n\
+ [drive:] Specifies the drive to format.\n\
+ -FS:file-system Specifies the type of file system (e.g. FAT).\n\
+ -V:label Specifies volume label.\n\
+ -Q Performs a quick format.\n\
+ -A:size Overrides the default allocation unit size. Default
settings\n\
+ are strongly recommended for general use\n\
+ NTFS supports 512, 1024, 2048, 4096, 8192, 16K, 32K,
64K.\n\
+ FAT supports 8192, 16K, 32K, 64K, 128K, 256K.\n\
+ NTFS compression is not supported for allocation
unit sizes\n\
+ above 4096.\n\
+ -C Files created on the new volume will be compressed
by\n\
+ default.\n\n"
+
+STRING_COMPLETE "%lu percent completed.\r"
+
+STRING_FORMAT_FAIL "FormatEx was unable to complete successfully.\n\n"
+
+STRING_NO_SUPPORT "Operation Not Supported"
+
+STRING_FMIFS_FAIL "Could not located FMIFS entry points.\n\n"
+
+STRING_UNKNOW_ARG "Unknown argument: %S\n"
+
+STRING_DRIVE_PARM "Required drive parameter is missing.\n\n"
+
+STRING_ERROR_DRIVE_TYPE "Could not get drive type"
+
+STRING_INSERT_DISK "Insert a new floppy in drive %C:\nand press
Enter when ready..."
+
+STRING_NO_VOLUME "Could not query volume"
+
+STRING_NO_VOLUME_SIZE "Could not query volume size"
+
+STRING_FILESYSTEM "The type of the file system is %S.\n"
+
+STRING_LABEL_NAME_EDIT "Enter current volume label for drive %C: "
+
+STRING_ERROR_LABEL "An incorrect volume label was entered for this
drive.\n"
+
+STRING_YN_FORMAT "\nWARNING, ALL DATA ON NON_REMOVABLE DISK\n\
+DRIVE %C: WILL BE LOST!\nProceed with Format (Y/N)? "
+
+STRING_YES_NO_FAQ "YN"
+
+STRING_VERIFYING "Verifying"
+
+STRING_FAST_FMT "QuickFormatting"
+
+STRING_CREATE_FSYS "Creating file system structures.\n"
+
+STRING_FMT_COMPLETE "Format complete.\n"
+
+STRING_VOL_COMPRESS "Volume does not support compression.\n"
+
+STRING_ENTER_LABEL "Volume Label (11 characters, Enter for none)? "
+
+STRING_NO_LABEL "Could not label volume"
+
+STRING_FREE_SPACE "\n%I64d bytes total disk space.\n%I64d bytes
available on disk.\n"
+
+STRING_SERIAL_NUMBER "\nVolume Serial Number is %04X-%04X\n"
+}
Property changes on: trunk/reactos/subsys/system/format/En.rc
___________________________________________________________________
Name: svn:keywords
+ author date id revision
Name: svn:eol-style
+ native
_____
Modified: trunk/reactos/subsys/system/format/format.c
--- trunk/reactos/subsys/system/format/format.c 2005-05-08 22:02:16 UTC
(rev 15156)
+++ trunk/reactos/subsys/system/format/format.c 2005-05-09 00:05:15 UTC
(rev 15157)
@@ -9,6 +9,7 @@
#include <ntos.h>
#include <fmifs.h>
#include <tchar.h>
+#include "resource.h"
// Globals
BOOL Error = FALSE;
@@ -78,20 +79,9 @@
//----------------------------------------------------------------------
static VOID Usage( LPTSTR ProgramName )
{
- _tprintf(_T("Usage: %S drive: [-FS:file-system] [-V:label] [-Q]
[-A:size] [-C]\n\n"), ProgramName);
- _tprintf(_T(" [drive:] Specifies the drive to
format.\n"));
- _tprintf(_T(" -FS:file-system Specifies the type of file
system (e.g. FAT).\n"));
- _tprintf(_T(" -V:label Specifies volume label.\n"));
- _tprintf(_T(" -Q Performs a quick format.\n"));
- _tprintf(_T(" -A:size Overrides the default allocation
unit size. Default settings\n"));
- _tprintf(_T(" are strongly recommended for
general use\n"));
- _tprintf(_T(" NTFS supports 512, 1024, 2048,
4096, 8192, 16K, 32K, 64K.\n"));
- _tprintf(_T(" FAT supports 8192, 16K, 32K,
64K, 128K, 256K.\n"));
- _tprintf(_T(" NTFS compression is not
supported for allocation unit sizes\n"));
- _tprintf(_T(" above 4096.\n"));
- _tprintf(_T(" -C Files created on the new volume
will be compressed by\n"));
- _tprintf(_T(" default.\n"));
- _tprintf(_T("\n"));
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ LoadString( GetModuleHandle(NULL), STRING_HELP, (LPTSTR)
szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg, ProgramName);
}
@@ -187,6 +177,7 @@
PDWORD percent;
PTEXTOUTPUT output;
PBOOLEAN status;
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
//
// We get other types of commands, but we don't have to pay
attention to them
@@ -195,7 +186,8 @@
case PROGRESS:
percent = (PDWORD) Argument;
- _tprintf(_T("%lu percent completed.\r"), *percent);
+ LoadString( GetModuleHandle(NULL), STRING_COMPLETE, (LPTSTR)
szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg, *percent);
break;
case OUTPUT:
@@ -207,7 +199,8 @@
status = (PBOOLEAN) Argument;
if( *status == FALSE ) {
- _tprintf(_T("FormatEx was unable to complete
successfully.\n\n"));
+ LoadString( GetModuleHandle(NULL),
STRING_FORMAT_FAIL, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg);
Error = TRUE;
}
break;
@@ -224,7 +217,8 @@
case UNKNOWNC:
case UNKNOWND:
case STRUCTUREPROGRESS:
- _tprintf(_T("Operation Not Supported"));
+ LoadString( GetModuleHandle(NULL), STRING_NO_SUPPORT,
(LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg);
return FALSE;
}
return TRUE;
@@ -281,13 +275,15 @@
#ifndef UNICODE
WCHAR RootDirectoryW[MAX_PATH], FormatW[MAX_PATH],
LabelW[MAX_PATH];
#endif
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
//
// Get function pointers
//
if( !LoadFMIFSEntryPoints()) {
-
- _tprintf(_T("Could not located FMIFS entry
points.\n\n"));
+
+ LoadString( GetModuleHandle(NULL), STRING_FMIFS_FAIL,
(LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg);
return -1;
}
@@ -296,7 +292,8 @@
//
if( (badArg = ParseCommandLine( argc, argv ))) {
- _tprintf(_T("Unknown argument: %S\n"), argv[badArg] );
+ LoadString( GetModuleHandle(NULL), STRING_UNKNOW_ARG,
(LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg, argv[badArg] );
Usage(argv[0]);
return -1;
@@ -307,7 +304,8 @@
//
if( !Drive ) {
- _tprintf(_T("Required drive parameter is
missing.\n\n"));
+ LoadString( GetModuleHandle(NULL), STRING_DRIVE_PARM,
(LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg);
Usage( argv[0] );
return -1;
@@ -324,13 +322,14 @@
driveType = GetDriveType( RootDirectory );
if( driveType == 0 ) {
- PrintWin32Error( _T("Could not get drive type"),
GetLastError());
+ LoadString( GetModuleHandle(NULL),
STRING_ERROR_DRIVE_TYPE, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ PrintWin32Error( szMsg, GetLastError());
return -1;
}
if( driveType != DRIVE_FIXED ) {
- _tprintf(_T("Insert a new floppy in drive %C:\nand press
Enter when ready..."),
- RootDirectory[0] );
+ LoadString( GetModuleHandle(NULL), STRING_INSERT_DISK,
(LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg, RootDirectory[0] );
_fgetts( input, sizeof(input)/2, stdin );
media = FMIFS_FLOPPY;
@@ -344,7 +343,8 @@
&serialNumber,
&maxComponent, &flags,
fileSystem,
sizeof(fileSystem)/2)) {
- PrintWin32Error( _T("Could not query volume"),
GetLastError());
+ LoadString( GetModuleHandle(NULL), STRING_NO_VOLUME,
(LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ PrintWin32Error( szMsg, GetLastError());
return -1;
}
@@ -353,10 +353,12 @@
&totalNumberOfBytes,
&totalNumberOfFreeBytes )) {
- PrintWin32Error( _T("Could not query volume size"),
GetLastError());
+ LoadString( GetModuleHandle(NULL),
STRING_NO_VOLUME_SIZE, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ PrintWin32Error( szMsg, GetLastError());
return -1;
}
- _tprintf(_T("The type of the file system is %S.\n"), fileSystem
);
+ LoadString( GetModuleHandle(NULL), STRING_FILESYSTEM, (LPTSTR)
szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg, fileSystem );
//
// Make sure they want to do this
@@ -367,7 +369,8 @@
while(1 ) {
- _tprintf(_T("Enter current volume label
for drive %C: "), RootDirectory[0] );
+ LoadString( GetModuleHandle(NULL),
STRING_LABEL_NAME_EDIT, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg, RootDirectory[0] );
_fgetts( input, sizeof(input)/2, stdin
);
input[ _tcslen( input ) - 1] = 0;
@@ -375,20 +378,22 @@
break;
}
- _tprintf(_T("An incorrect volume label
was entered for this drive.\n"));
+ LoadString( GetModuleHandle(NULL),
STRING_ERROR_LABEL, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg);
}
}
while( 1 ) {
- _tprintf(_T("\nWARNING, ALL DATA ON
NON_REMOVABLE DISK\n"));
- _tprintf(_T("DRIVE %C: WILL BE LOST!\n"),
RootDirectory[0] );
- _tprintf(_T("Proceed with Format (Y/N)? " ));
- _fgetts( input, sizeof(input)/2, stdin );
+ LoadString( GetModuleHandle(NULL),
STRING_YN_FORMAT, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg, RootDirectory[0] );
- if( input[0] == _T('Y') || input[0] == _T('y') )
break;
+
+ LoadString( GetModuleHandle(NULL),
STRING_YES_NO_FAQ, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+
+ if( _strnicmp(&input[0],&szMsg[0],1)) break;
- if( input[0] == _T('N') || input[0] ==
_T('n') ) {
+ if( _strnicmp(&input[0],&szMsg[1],1) ) {
_tprintf(_T("\n"));
return 0;
@@ -402,27 +407,31 @@
//
if( !QuickFormat ) {
+ LoadString( GetModuleHandle(NULL), STRING_VERIFYING,
(LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+
if( totalNumberOfBytes.QuadPart > 1024*1024*10 ) {
- _tprintf(_T("Verifying %luM\n"), (DWORD)
(totalNumberOfBytes.QuadPart/(1024*1024)));
+ _tprintf(_T("%s %luM\n"),szMsg, (DWORD)
(totalNumberOfBytes.QuadPart/(1024*1024)));
} else {
- _tprintf(_T("Verifying %.1fM\n"),
+ _tprintf(_T("%s %.1fM\n"),szMsg,
((float)(LONGLONG)totalNumberOfBytes.QuadPart)/(float)(1024.0*1024.0));
}
} else {
+ LoadString( GetModuleHandle(NULL), STRING_FAST_FMT,
(LPTSTR) szMsg,RC_STRING_MAX_SIZE);
if( totalNumberOfBytes.QuadPart > 1024*1024*10 ) {
- _tprintf(_T("QuickFormatting %luM\n"), (DWORD)
(totalNumberOfBytes.QuadPart/(1024*1024)));
+ _tprintf(_T("%s %luM\n"),szMsg, (DWORD)
(totalNumberOfBytes.QuadPart/(1024*1024)));
} else {
- _tprintf(_T("QuickFormatting %.2fM\n"),
+ _tprintf(_T("%s %.2fM\n"),szMsg,
((float)(LONGLONG)totalNumberOfBytes.QuadPart)/(float)(1024.0*1024.0));
}
- _tprintf(_T("Creating file system structures.\n"));
+ LoadString( GetModuleHandle(NULL), STRING_CREATE_FSYS,
(LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg);
}
//
@@ -439,7 +448,8 @@
ClusterSize, FormatExCallback );
#endif
if( Error ) return -1;
- _tprintf(_T("Format complete.\n"));
+ LoadString( GetModuleHandle(NULL), STRING_FMT_COMPLETE, (LPTSTR)
szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg);
//
// Enable compression if desired
@@ -453,7 +463,8 @@
if( !EnableVolumeCompression( RootDirectory, TRUE )) {
#endif
- _tprintf(_T("Volume does not support
compression.\n"));
+ LoadString( GetModuleHandle(NULL),
STRING_VOL_COMPRESS, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg);
}
}
@@ -462,13 +473,15 @@
//
if( !GotALabel ) {
- _tprintf(_T("Volume Label (11 characters, Enter for
none)? " ));
+ LoadString( GetModuleHandle(NULL), STRING_ENTER_LABEL,
(LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg);
_fgetts( input, sizeof(LabelString)/2, stdin );
input[ _tcslen(input)-1] = 0;
if( !SetVolumeLabel( RootDirectory, input )) {
- PrintWin32Error(_T("Could not label volume"),
GetLastError());
+ LoadString( GetModuleHandle(NULL),
STRING_NO_LABEL, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ PrintWin32Error(szMsg, GetLastError());
return -1;
}
}
@@ -478,7 +491,8 @@
&serialNumber,
&maxComponent, &flags,
fileSystem,
sizeof(fileSystem)/2)) {
- PrintWin32Error( _T("Could not query volume"),
GetLastError());
+ LoadString( GetModuleHandle(NULL), STRING_NO_VOLUME,
(LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ PrintWin32Error( szMsg, GetLastError());
return -1;
}
@@ -489,13 +503,14 @@
&freeBytesAvailableToCaller,
&totalNumberOfBytes,
&totalNumberOfFreeBytes )) {
-
- PrintWin32Error( _T("Could not query volume size"),
GetLastError());
+
+ LoadString( GetModuleHandle(NULL),
STRING_NO_VOLUME_SIZE, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ PrintWin32Error(szMsg, GetLastError());
return -1;
}
- _tprintf(_T("\n%I64d bytes total disk space.\n"),
totalNumberOfBytes.QuadPart );
- _tprintf(_T("%I64d bytes available on disk.\n"),
totalNumberOfFreeBytes.QuadPart );
+ LoadString( GetModuleHandle(NULL), STRING_FREE_SPACE, (LPTSTR)
szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg, totalNumberOfBytes.QuadPart,
totalNumberOfFreeBytes.QuadPart );
//
// Get the drive's serial number
@@ -505,10 +520,12 @@
&serialNumber,
&maxComponent, &flags,
fileSystem,
sizeof(fileSystem)/2)) {
- PrintWin32Error( _T("Could not query volume"),
GetLastError());
+ LoadString( GetModuleHandle(NULL), STRING_NO_VOLUME,
(LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ PrintWin32Error( szMsg, GetLastError());
return -1;
}
- _tprintf(_T("\nVolume Serial Number is %04X-%04X\n"), (unsigned
int)(serialNumber >> 16),
+ LoadString( GetModuleHandle(NULL), STRING_SERIAL_NUMBER,
(LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+ _tprintf(szMsg, (unsigned int)(serialNumber >> 16),
(unsigned int)(serialNumber &
0xFFFF) );
return 0;
_____
Modified: trunk/reactos/subsys/system/format/format.rc
--- trunk/reactos/subsys/system/format/format.rc 2005-05-08
22:02:16 UTC (rev 15156)
+++ trunk/reactos/subsys/system/format/format.rc 2005-05-09
00:05:15 UTC (rev 15157)
@@ -5,3 +5,5 @@
#define REACTOS_STR_ORIGINAL_FILENAME "format.exe\0"
#include <reactos/version.rc>
+#include "En.rc"
+
_____
Added: trunk/reactos/subsys/system/format/resource.h
--- trunk/reactos/subsys/system/format/resource.h 2005-05-08
22:02:16 UTC (rev 15156)
+++ trunk/reactos/subsys/system/format/resource.h 2005-05-09
00:05:15 UTC (rev 15157)
@@ -0,0 +1,31 @@
+
+
+#define RC_STRING_MAX_SIZE 4096
+
+#define STRING_HELP 100
+#define STRING_COMPLETE 101
+#define STRING_FORMAT_FAIL 102
+#define STRING_NO_SUPPORT 103
+#define STRING_FMIFS_FAIL 104
+#define STRING_UNKNOW_ARG 105
+#define STRING_DRIVE_PARM 106
+#define STRING_ERROR_DRIVE_TYPE 107
+#define STRING_INSERT_DISK 108
+#define STRING_NO_VOLUME 109
+#define STRING_NO_VOLUME_SIZE 110
+#define STRING_FILESYSTEM 111
+#define STRING_LABEL_NAME_EDIT 112
+#define STRING_ERROR_LABEL 113
+#define STRING_YN_FORMAT 114
+#define STRING_YES_NO_FAQ 115
+#define STRING_VERIFYING 116
+#define STRING_FAST_FMT 117
+#define STRING_CREATE_FSYS 118
+#define STRING_FMT_COMPLETE 119
+#define STRING_VOL_COMPRESS 120
+#define STRING_ENTER_LABEL 121
+#define STRING_NO_LABEL 122
+#define STRING_FREE_SPACE 123
+#define STRING_SERIAL_NUMBER 124
+
+/* EOF */
Property changes on: trunk/reactos/subsys/system/format/resource.h
___________________________________________________________________
Name: svn:keywords
+ author date id revision
Name: svn:eol-style
+ native