Added: trunk/reactos/subsys/system/cmd/En.rc
Modified: trunk/reactos/subsys/system/cmd/attrib.c
Modified: trunk/reactos/subsys/system/cmd/choice.c
Modified: trunk/reactos/subsys/system/cmd/cmd.rc
Modified: trunk/reactos/subsys/system/cmd/internal.c
Added: trunk/reactos/subsys/system/cmd/resource.h
--- trunk/reactos/subsys/system/cmd/En.rc 2005-04-02 19:52:29 UTC (rev 14456)
+++ trunk/reactos/subsys/system/cmd/En.rc 2005-04-02 20:23:01 UTC (rev 14457)
@@ -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"
+
+}
--- trunk/reactos/subsys/system/cmd/attrib.c 2005-04-02 19:52:29 UTC (rev 14456)
+++ trunk/reactos/subsys/system/cmd/attrib.c 2005-04-02 20:23:01 UTC (rev 14457)
@@ -30,6 +30,7 @@
*/
#include "precomp.h"
+#include "resource.h"
#ifdef INCLUDE_CMD_ATTRIB
@@ -40,7 +41,7 @@
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 @@
TCHAR szFullName[MAX_PATH];
LPTSTR pszFileName;
+
/* prepare full file name buffer */
_tcscpy (szFullName, pszPath);
pszFileName = szFullName + _tcslen (szFullName);
@@ -192,6 +194,7 @@
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 @@
/* 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;
}
--- trunk/reactos/subsys/system/cmd/choice.c 2005-04-02 19:52:29 UTC (rev 14456)
+++ trunk/reactos/subsys/system/cmd/choice.c 2005-04-02 20:23:01 UTC (rev 14457)
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
}
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;
}
--- trunk/reactos/subsys/system/cmd/cmd.rc 2005-04-02 19:52:29 UTC (rev 14456)
+++ trunk/reactos/subsys/system/cmd/cmd.rc 2005-04-02 20:23:01 UTC (rev 14457)
@@ -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 <reactos/version.rc>
+#include "En.rc"
+
+
1 ICON DISCARDABLE res/terminal.ico
+
+
+
+
+
--- trunk/reactos/subsys/system/cmd/internal.c 2005-04-02 19:52:29 UTC (rev 14456)
+++ trunk/reactos/subsys/system/cmd/internal.c 2005-04-02 20:23:01 UTC (rev 14457)
@@ -122,11 +122,15 @@
*
* 23-Feb-2001 (Carl Nettelblad <cnettel@hem.passagen.se>)
* Improved chdir/cd command.
+ *
+ * 02-Apr-2004 (Magnus Olsen <magnus@greatlord.com>)
+ Remove all hard code string so they can be
+ translate to other langues.
*/
#include "precomp.h"
+#include "resource.h"
-
#ifdef INCLUDE_CMD_CHDIR
static LPTSTR lpLastPath;
@@ -154,21 +158,15 @@
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 @@
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 @@
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 @@
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 @@
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 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 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;
--- trunk/reactos/subsys/system/cmd/resource.h 2005-04-02 19:52:29 UTC (rev 14456)
+++ trunk/reactos/subsys/system/cmd/resource.h 2005-04-02 20:23:01 UTC (rev 14457)
@@ -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
+
+
+
+