diff --git a/reactos/subsys/system/cmd/En.rc b/reactos/subsys/system/cmd/En.rc new file mode 100644 index 00000000000..064a2462fc2 --- /dev/null +++ b/reactos/subsys/system/cmd/En.rc @@ -0,0 +1,63 @@ +#include "resource.h" +/* Start move all hard code string to En.rc + * By Magnus Olsen 2005 + */ + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT +STRINGTABLE DISCARDABLE +{ +STRING_ATTRIB_HELP, "Displays or changes file attributes.\n\n \ +ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] file ...\n \ + [/S [/D]]\n\n \ + + Sets an attribute\n \ + - Clears an attribute\n \ + R Read-only file attribute\n \ + A Archive file attribute\n \ + S System file attribute\n \ + H Hidden file attribute\n \ + /S Processes matching files in the current directory\n \ + and all subdirectories\n \ + /D Processes direcories as well\n\n \ +Type ATTRIB without a parameter to display the attributes of all files." + +STRING_CD_HELP, "Changes the current directory or displays it's name\n\n \ +CHDIR [drive:][path]\n \ +CHDIR[..|-]\n \ +CD [drive:][path]\n \ +CD[..|-]\n\n \ + .. parent directory\n \ + - previous directory\n\n \ +Type CD drive: to display the current directory on the specified drive.\n \ +Type CD without a parameter to display the current drive and directory. " + +STRING_CHOICE_HELP, "Waits for the user to choose one of a set of choices.\n\n \ +CHOICE [/C[:]choices][/N][/S][/T[:]c,nn][text]\n\n \ + /C[:]choices Specifies allowable keys. Default is YN.\n \ + /N Do not display choices and ? at the end of the prompt string.\n \ + /S Treat choice keys as case sensitive.\n \ + /T[:]c,nn Default choice to c after nn seconds.\n \ + text Prompt string to display.\n\n \ +ERRORLEVEL is set to offset of key user presses in choices." + +STRING_EXIT_HELP, "Exits the command line interpreter.\n\nEXIT" + +STRING_MKDIR_HELP, "Creates a directory.\n\n \ +MKDIR [drive:]path\nMD [drive:]path" + +STRING_RMDIR_HELP, "Removes a directory.\n\n \ +RMDIR [drive:]path\nRD [drive:]path" + +STRING_REM_HELP, "Starts a comment line in a batch file.\n\nREM [Comment]" + + + +STRING_CHOICE_OPTION "YN" + + + +STRING_CHOICE_ERROR, "Invalid option. Expected format: /C[:]options" +STRING_CHOICE_ERROR_TXT, "Invalid option. Expected format: /T[:]c,nn" +STRING_CHOICE_ERROR_OPTION, "Illegal Option: %s" +STRING_PARAM_ERROR, "Required parameter missing\n" + +} diff --git a/reactos/subsys/system/cmd/attrib.c b/reactos/subsys/system/cmd/attrib.c index e21f3a053f7..9a08a69c71a 100644 --- a/reactos/subsys/system/cmd/attrib.c +++ b/reactos/subsys/system/cmd/attrib.c @@ -30,6 +30,7 @@ */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_ATTRIB @@ -40,7 +41,7 @@ PrintAttribute (LPTSTR pszPath, LPTSTR pszFile, BOOL bRecurse) WIN32_FIND_DATA findData; HANDLE hFind; TCHAR szFullName[MAX_PATH]; - LPTSTR pszFileName; + LPTSTR pszFileName; /* prepare full file name buffer */ _tcscpy (szFullName, pszPath); @@ -116,6 +117,7 @@ ChangeAttribute (LPTSTR pszPath, LPTSTR pszFile, DWORD dwMask, TCHAR szFullName[MAX_PATH]; LPTSTR pszFileName; + /* prepare full file name buffer */ _tcscpy (szFullName, pszPath); pszFileName = szFullName + _tcslen (szFullName); @@ -192,6 +194,7 @@ INT CommandAttrib (LPTSTR cmd, LPTSTR param) BOOL bDirectories = FALSE; DWORD dwAttrib = 0; DWORD dwMask = 0; + WCHAR szMsg[RC_STRING_MAX_SIZE]; /* initialize strings */ szPath[0] = _T('\0'); @@ -200,19 +203,8 @@ INT CommandAttrib (LPTSTR cmd, LPTSTR param) /* print help */ if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Displays or changes file attributes.\n\n" - "ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] file ...\n" - " [/S [/D]]\n\n" - " + Sets an attribute\n" - " - Clears an attribute\n" - " R Read-only file attribute\n" - " A Archive file attribute\n" - " S System file attribute\n" - " H Hidden file attribute\n" - " /S Processes matching files in the current directory\n" - " and all subdirectories\n" - " /D Processes direcories as well\n\n" - "Type ATTRIB without a parameter to display the attributes of all files.")); + LoadString( GetModuleHandle(NULL), STRING_ATTRIB_HELP, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); return 0; } diff --git a/reactos/subsys/system/cmd/choice.c b/reactos/subsys/system/cmd/choice.c index 6cc6426d0db..d77742dd11e 100644 --- a/reactos/subsys/system/cmd/choice.c +++ b/reactos/subsys/system/cmd/choice.c @@ -12,9 +12,14 @@ * * 26 Sep 1999 (Paolo Pantaleo) * Fixed timeout. + * + * 02 Apr 2005 (Magnus Olsen + * Remove Hardcode string so + * they can be translate */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_CHOICE @@ -97,7 +102,8 @@ IsKeyInString (LPTSTR lpString, TCHAR cKey, BOOL bCaseSensitive) INT CommandChoice (LPTSTR cmd, LPTSTR param) { - LPTSTR lpOptions = _T("YN"); + LPTSTR lpOptions; + TCHAR Options[2]; LPTSTR lpText = NULL; BOOL bNoPrompt = FALSE; BOOL bCaseSensitive = FALSE; @@ -114,21 +120,17 @@ CommandChoice (LPTSTR cmd, LPTSTR param) INT GCret; TCHAR Ch; DWORD amount,clk; + WCHAR szMsg[RC_STRING_MAX_SIZE]; + + LoadString( GetModuleHandle(NULL), STRING_CHOICE_OPTION, (LPTSTR) Options,sizeof(lpOptions)); + lpOptions = _T(Options); if (_tcsncmp (param, _T("/?"), 2) == 0) { - ConOutPuts (_T("Waits for the user to choose one of a set of choices.\n" - "\n" - "CHOICE [/C[:]choices][/N][/S][/T[:]c,nn][text]\n" - "\n" - " /C[:]choices Specifies allowable keys. Default is YN.\n" - " /N Do not display choices and ? at the end of the prompt string.\n" - " /S Treat choice keys as case sensitive.\n" - " /T[:]c,nn Default choice to c after nn seconds.\n" - " text Prompt string to display.\n" - "\n" - "ERRORLEVEL is set to offset of key user presses in choices.")); - return 0; + LoadString( GetModuleHandle(NULL), STRING_CHOICE_HELP, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); + + return 0; } /* retrieve text */ @@ -167,7 +169,9 @@ CommandChoice (LPTSTR cmd, LPTSTR param) if (_tcslen (lpOptions) == 0) { - ConErrPuts (_T("Invalid option. Expected format: /C[:]options")); + + LoadString( GetModuleHandle(NULL), STRING_CHOICE_ERROR, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPuts (_T((LPTSTR)szMsg)); freep (arg); return 1; } @@ -197,7 +201,8 @@ CommandChoice (LPTSTR cmd, LPTSTR param) if (*s != _T(',')) { - ConErrPuts (_T("Invalid option. Expected format: /T[:]c,nn")); + LoadString( GetModuleHandle(NULL), STRING_CHOICE_ERROR_TXT, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPuts (_T((LPTSTR)szMsg)); freep (arg); return 1; } @@ -208,7 +213,8 @@ CommandChoice (LPTSTR cmd, LPTSTR param) } else if (arg[i][0] == _T('/')) { - ConErrPrintf (_T("Illegal Option: %s"), arg[i]); + LoadString( GetModuleHandle(NULL), STRING_CHOICE_ERROR_OPTION, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPrintf (_T((LPTSTR)szMsg), arg[i]); freep (arg); return 1; } diff --git a/reactos/subsys/system/cmd/cmd.rc b/reactos/subsys/system/cmd/cmd.rc index 448bcd966b8..ad10b0dd4f4 100644 --- a/reactos/subsys/system/cmd/cmd.rc +++ b/reactos/subsys/system/cmd/cmd.rc @@ -7,5 +7,13 @@ #define REACTOS_STR_ORIGINAL_COPYRIGHT "Copyright (C) 1994-1998 Tim Norman and others\0" #define REACTOS_STR_LEGAL_COPYRIGHT "Copyright (C) 1998-2001 Eric Kohl and others\0" #include +#include "En.rc" + + 1 ICON DISCARDABLE res/terminal.ico + + + + + diff --git a/reactos/subsys/system/cmd/internal.c b/reactos/subsys/system/cmd/internal.c index 62ab3b98b8c..73c870189dc 100644 --- a/reactos/subsys/system/cmd/internal.c +++ b/reactos/subsys/system/cmd/internal.c @@ -122,10 +122,14 @@ * * 23-Feb-2001 (Carl Nettelblad ) * Improved chdir/cd command. + * + * 02-Apr-2004 (Magnus Olsen ) + Remove all hard code string so they can be + translate to other langues. */ #include "precomp.h" - +#include "resource.h" #ifdef INCLUDE_CMD_CHDIR @@ -154,21 +158,15 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param) LPTSTR lpOldPath; LPTSTR endofstring; /* pointer to the null character in the directory to change to */ LPTSTR lastquote; /* pointer to the last quotation mark in the directory to change to */ + WCHAR szMsg[RC_STRING_MAX_SIZE]; /*Should we better declare a variable containing _tsclen(dir) ? It's used a few times, but on the other hand paths are generally not very long*/ if (!_tcsncmp (param, _T("/?"), 2)) - { - ConOutPuts (_T("Changes the current directory or displays it's name\n\n" - "CHDIR [drive:][path]\n" - "CHDIR[..|-]\n" - "CD [drive:][path]\n" - "CD[..|-]\n\n" - " .. parent directory\n" - " - previous directory\n\n" - "Type CD drive: to display the current directory on the specified drive.\n" - "Type CD without a parameter to display the current drive and directory.")); + { + LoadString( GetModuleHandle(NULL), STRING_CD_HELP, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); return 0; } @@ -281,12 +279,13 @@ INT cmd_mkdir (LPTSTR cmd, LPTSTR param) LPTSTR place; /* used to search for the \ when no space is used */ LPTSTR *p = NULL; INT argc; - + WCHAR szMsg[RC_STRING_MAX_SIZE]; if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Creates a directory.\n\n" - "MKDIR [drive:]path\nMD [drive:]path")); + LoadString( GetModuleHandle(NULL), STRING_MKDIR_HELP, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); + return 0; } @@ -321,7 +320,8 @@ INT cmd_mkdir (LPTSTR cmd, LPTSTR param) if (!dir) { - ConErrPrintf (_T("Required parameter missing\n")); + LoadString( GetModuleHandle(NULL), STRING_PARAM_ERROR, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPrintf (_T((LPTSTR)szMsg)); return 1; } @@ -357,10 +357,15 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param) LPTSTR *p = NULL; INT argc; + + WCHAR szMsg[RC_STRING_MAX_SIZE]; + if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Removes a directory.\n\n" - "RMDIR [drive:]path\nRD [drive:]path")); + LoadString( GetModuleHandle(NULL), STRING_RMDIR_HELP, (LPTSTR) szMsg,sizeof(szMsg)); + + ConOutPuts (_T((LPTSTR)szMsg)); + return 0; } @@ -394,7 +399,9 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param) if (!dir) { - ConErrPrintf (_T("Required parameter missing\n")); + LoadString( GetModuleHandle(NULL), STRING_PARAM_ERROR, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPrintf (_T((LPTSTR)szMsg)); + return 1; } @@ -423,9 +430,12 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param) */ INT CommandExit (LPTSTR cmd, LPTSTR param) { + WCHAR szMsg[RC_STRING_MAX_SIZE]; + if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Exits the command line interpreter.\n\nEXIT")); + LoadString( GetModuleHandle(NULL), STRING_EXIT_HELP, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); return 0; } @@ -441,10 +451,12 @@ INT CommandExit (LPTSTR cmd, LPTSTR param) */ INT CommandRem (LPTSTR cmd, LPTSTR param) { + WCHAR szMsg[RC_STRING_MAX_SIZE]; + if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Starts a comment line in a batch file.\n\n" - "REM [Comment]")); + LoadString( GetModuleHandle(NULL), STRING_REM_HELP, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); } return 0; diff --git a/reactos/subsys/system/cmd/resource.h b/reactos/subsys/system/cmd/resource.h new file mode 100644 index 00000000000..385a9e01b04 --- /dev/null +++ b/reactos/subsys/system/cmd/resource.h @@ -0,0 +1,22 @@ +#define RC_STRING_MAX_SIZE 2048 + +#define STRING_CHOICE_OPTION 200 + +#define STRING_PARAM_ERROR 300 +#define STRING_CHOICE_ERROR 301 +#define STRING_CHOICE_ERROR_TXT 302 +#define STRING_CHOICE_ERROR_OPTION 303 + + + +#define STRING_ATTRIB_HELP 400 +#define STRING_CD_HELP 401 +#define STRING_CHOICE_HELP 402 +#define STRING_EXIT_HELP 403 +#define STRING_MKDIR_HELP 404 +#define STRING_RMDIR_HELP 405 +#define STRING_REM_HELP 406 + + + +