mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:25:39 +00:00
[CHKDSK] Implement localization support (#891)
- Make the strings translatable. - Include the English translation within the main resource file. - Use ConResPrintf() and ConResPuts() for resource strings.
This commit is contained in:
parent
e9f993d1b8
commit
8e48f8f2dd
4 changed files with 74 additions and 24 deletions
|
@ -49,6 +49,9 @@
|
||||||
|
|
||||||
#include <conutils.h>
|
#include <conutils.h>
|
||||||
|
|
||||||
|
/* Resource header */
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
#define NTOS_MODE_USER
|
#define NTOS_MODE_USER
|
||||||
#include <ndk/ntndk.h>
|
#include <ndk/ntndk.h>
|
||||||
|
|
||||||
|
@ -85,9 +88,9 @@ PCHKDSK Chkdsk;
|
||||||
// Takes the win32 error code and prints the text version.
|
// Takes the win32 error code and prints the text version.
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
static VOID PrintWin32Error(LPWSTR Message, DWORD ErrorCode)
|
static VOID PrintWin32Error(int Message, DWORD ErrorCode)
|
||||||
{
|
{
|
||||||
ConPrintf(StdErr, L"%s: ", Message);
|
ConResPuts(StdErr, Message);
|
||||||
ConMsgPuts(StdErr, FORMAT_MESSAGE_FROM_SYSTEM,
|
ConMsgPuts(StdErr, FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
NULL, ErrorCode, LANG_USER_DEFAULT);
|
NULL, ErrorCode, LANG_USER_DEFAULT);
|
||||||
ConPuts(StdErr, L"\n");
|
ConPuts(StdErr, L"\n");
|
||||||
|
@ -123,14 +126,7 @@ CtrlCIntercept(DWORD dwCtrlType)
|
||||||
static VOID
|
static VOID
|
||||||
Usage(PWCHAR ProgramName)
|
Usage(PWCHAR ProgramName)
|
||||||
{
|
{
|
||||||
ConPrintf(StdOut,
|
ConResPrintf(StdOut, IDS_USAGE, ProgramName);
|
||||||
L"Usage: %s [drive:] [-F] [-V] [-R] [-C]\n\n"
|
|
||||||
L"[drive:] Specifies the drive to check.\n"
|
|
||||||
L"-F Fixes errors on the disk.\n"
|
|
||||||
L"-V Displays the full path of every file on the disk.\n"
|
|
||||||
L"-R Locates bad sectors and recovers readable information.\n"
|
|
||||||
L"-C Checks the drive only if it is dirty.\n\n",
|
|
||||||
ProgramName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -261,7 +257,7 @@ ChkdskCallback(
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VOLUMEINUSE:
|
case VOLUMEINUSE:
|
||||||
ConPuts(StdOut, L"Volume is in use and cannot be locked\n");
|
ConResPuts(StdOut, IDS_VOLUME_IN_USE);
|
||||||
Ret = FALSE;
|
Ret = FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -299,7 +295,7 @@ ChkdskCallback(
|
||||||
|
|
||||||
case PROGRESS:
|
case PROGRESS:
|
||||||
percent = (PDWORD)Argument;
|
percent = (PDWORD)Argument;
|
||||||
ConPrintf(StdOut, L"%d percent completed.\r", *percent);
|
ConResPrintf(StdOut, IDS_PERCENT_COMPL, *percent);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OUTPUT:
|
case OUTPUT:
|
||||||
|
@ -311,7 +307,7 @@ ChkdskCallback(
|
||||||
status = (PBOOLEAN)Argument;
|
status = (PBOOLEAN)Argument;
|
||||||
if (*status == FALSE)
|
if (*status == FALSE)
|
||||||
{
|
{
|
||||||
ConPuts(StdOut, L"Chkdsk was unable to complete successfully.\n\n");
|
ConResPuts(StdOut, IDS_CHKDSK_FAIL);
|
||||||
Error = TRUE;
|
Error = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -371,11 +367,7 @@ wmain(int argc, WCHAR *argv[])
|
||||||
/* Initialize the Console Standard Streams */
|
/* Initialize the Console Standard Streams */
|
||||||
ConInitStdStreams();
|
ConInitStdStreams();
|
||||||
|
|
||||||
ConPuts(StdOut,
|
ConResPuts(StdOut, IDS_ABOUT);
|
||||||
L"\n"
|
|
||||||
L"Chkdskx v1.0.1 by Mark Russinovich\n"
|
|
||||||
L"Systems Internals - http://www.sysinternals.com\n"
|
|
||||||
L"ReactOS adaptation 1999 by Emanuele Aliberti\n\n");
|
|
||||||
|
|
||||||
#ifndef FMIFS_IMPORT_DLL
|
#ifndef FMIFS_IMPORT_DLL
|
||||||
//
|
//
|
||||||
|
@ -383,7 +375,7 @@ wmain(int argc, WCHAR *argv[])
|
||||||
//
|
//
|
||||||
if (!LoadFMIFSEntryPoints())
|
if (!LoadFMIFSEntryPoints())
|
||||||
{
|
{
|
||||||
ConPuts(StdErr, L"Could not located FMIFS entry points.\n\n");
|
ConResPuts(StdErr, IDS_NO_ENTRY_POINT);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -394,7 +386,7 @@ wmain(int argc, WCHAR *argv[])
|
||||||
badArg = ParseCommandLine(argc, argv);
|
badArg = ParseCommandLine(argc, argv);
|
||||||
if (badArg)
|
if (badArg)
|
||||||
{
|
{
|
||||||
ConPrintf(StdOut, L"Unknown argument: %s\n", argv[badArg]);
|
ConResPrintf(StdOut, IDS_BAD_ARGUMENT, argv[badArg]);
|
||||||
Usage(argv[0]);
|
Usage(argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -406,7 +398,7 @@ wmain(int argc, WCHAR *argv[])
|
||||||
{
|
{
|
||||||
if (!GetCurrentDirectoryW(ARRAYSIZE(CurrentDirectory), CurrentDirectory))
|
if (!GetCurrentDirectoryW(ARRAYSIZE(CurrentDirectory), CurrentDirectory))
|
||||||
{
|
{
|
||||||
PrintWin32Error(L"Could not get current directory", GetLastError());
|
PrintWin32Error(IDS_NO_CURRENT_DIR, GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -431,7 +423,7 @@ wmain(int argc, WCHAR *argv[])
|
||||||
fileSystem,
|
fileSystem,
|
||||||
ARRAYSIZE(fileSystem)))
|
ARRAYSIZE(fileSystem)))
|
||||||
{
|
{
|
||||||
PrintWin32Error(L"Could not query volume", GetLastError());
|
PrintWin32Error(IDS_NO_QUERY_VOL, GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,7 +442,7 @@ wmain(int argc, WCHAR *argv[])
|
||||||
0);
|
0);
|
||||||
if (volumeHandle == INVALID_HANDLE_VALUE)
|
if (volumeHandle == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
ConPuts(StdErr, L"Chkdsk cannot run because the volume is in use by another process.\n\n");
|
ConResPuts(StdErr, IDS_VOLUME_IN_USE_PROC);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
CloseHandle(volumeHandle);
|
CloseHandle(volumeHandle);
|
||||||
|
@ -464,7 +456,7 @@ wmain(int argc, WCHAR *argv[])
|
||||||
//
|
//
|
||||||
// Just do it
|
// Just do it
|
||||||
//
|
//
|
||||||
ConPrintf(StdOut, L"The type of file system is %s.\n", fileSystem);
|
ConResPrintf(StdOut, IDS_FILE_SYSTEM, fileSystem);
|
||||||
Chkdsk(Drive,
|
Chkdsk(Drive,
|
||||||
fileSystem,
|
fileSystem,
|
||||||
FixErrors,
|
FixErrors,
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
|
#include <windef.h>
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Disk Checking Utility"
|
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Disk Checking Utility"
|
||||||
#define REACTOS_STR_INTERNAL_NAME "chkdsk"
|
#define REACTOS_STR_INTERNAL_NAME "chkdsk"
|
||||||
#define REACTOS_STR_ORIGINAL_FILENAME "chkdsk.exe"
|
#define REACTOS_STR_ORIGINAL_FILENAME "chkdsk.exe"
|
||||||
#define REACTOS_STR_ORIGINAL_COPYRIGHT "1998 Mark Russinovich"
|
#define REACTOS_STR_ORIGINAL_COPYRIGHT "1998 Mark Russinovich"
|
||||||
#include <reactos/version.rc>
|
#include <reactos/version.rc>
|
||||||
|
|
||||||
|
/* UTF-8 */
|
||||||
|
#pragma code_page(65001)
|
||||||
|
|
||||||
|
#ifdef LANGUAGE_EN_US
|
||||||
|
#include "lang/en-US.rc"
|
||||||
|
#endif
|
||||||
|
|
31
base/system/chkdsk/lang/en-US.rc
Normal file
31
base/system/chkdsk/lang/en-US.rc
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
|
||||||
|
STRINGTABLE
|
||||||
|
BEGIN
|
||||||
|
IDS_USAGE "\n\
|
||||||
|
Usage: %s [drive:] [-F] [-V] [-R] [-C] \n\n\
|
||||||
|
[drive:] Specifies the drive to check.\n\
|
||||||
|
-F Fixes errors on the disk.\n\
|
||||||
|
-V Displays the full path of every file on the disk.\n\
|
||||||
|
-R Locates bad sectors and recovers readable information.\n\
|
||||||
|
-C Checks the drive only if it is dirty.\n\
|
||||||
|
\n"
|
||||||
|
|
||||||
|
IDS_PERCENT_COMPL "%d percent completed.\r"
|
||||||
|
IDS_FILE_SYSTEM "The type of file system is %s.\n"
|
||||||
|
IDS_ABOUT "\n\
|
||||||
|
Chkdskx v1.0.1 by Mark Russinovich\n\
|
||||||
|
Systems Internals - http://www.sysinternals.com\n\
|
||||||
|
ReactOS adaptation 1999 by Emanuele Aliberti\n\n"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE
|
||||||
|
BEGIN
|
||||||
|
IDS_VOLUME_IN_USE "Volume is in use and cannot be locked\n"
|
||||||
|
IDS_CHKDSK_FAIL "Chkdsk was unable to complete successfully.\n\n"
|
||||||
|
IDS_NO_ENTRY_POINT "Could not located FMIFS entry points.\n\n"
|
||||||
|
IDS_BAD_ARGUMENT "Unknown argument: %s\n"
|
||||||
|
IDS_NO_CURRENT_DIR "Could not get current directory. Error code: "
|
||||||
|
IDS_NO_QUERY_VOL "Could not query volume. Error code: "
|
||||||
|
IDS_VOLUME_IN_USE_PROC "Chkdsk cannot run because the volume is in use by another process.\n\n"
|
||||||
|
END
|
18
base/system/chkdsk/resource.h
Normal file
18
base/system/chkdsk/resource.h
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/* General IDs */
|
||||||
|
|
||||||
|
#define IDS_USAGE 101
|
||||||
|
#define IDS_PERCENT_COMPL 102
|
||||||
|
#define IDS_ABOUT 103
|
||||||
|
#define IDS_FILE_SYSTEM 104
|
||||||
|
|
||||||
|
/* Failure IDs */
|
||||||
|
|
||||||
|
#define IDS_VOLUME_IN_USE 200
|
||||||
|
#define IDS_CHKDSK_FAIL 201
|
||||||
|
#define IDS_NO_ENTRY_POINT 202
|
||||||
|
#define IDS_BAD_ARGUMENT 203
|
||||||
|
#define IDS_NO_CURRENT_DIR 204
|
||||||
|
#define IDS_NO_QUERY_VOL 205
|
||||||
|
#define IDS_VOLUME_IN_USE_PROC 206
|
||||||
|
|
||||||
|
/* EOF */
|
Loading…
Add table
Add a link
Reference in a new issue