- Localize the Usage message of "shutdown" and add a german localization

- Also add a version resource

Translators, feel free to make translations for this tool :-)

svn path=/trunk/; revision=27721
This commit is contained in:
Colin Finck 2007-07-18 18:40:07 +00:00
parent fc5c5f5b46
commit 13f80b1452
9 changed files with 139 additions and 14 deletions

View file

@ -0,0 +1,19 @@
/*
* German language file by Colin Finck <2007-07-18>
*/
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
STRINGTABLE DISCARDABLE
{
IDS_USAGE, "Syntax: shutdown [-?] [-l | -s | -r] [-f]\n\n\
Keine Argumente\tDiese Meldung anzeigen\n\
-?\t\t\tDiese Meldung anzeigen\n\
-l\t\t\tBenutzer abmelden\n\
-s\t\t\tComputer herunterfahren\n\
-r\t\t\tComputer herunterfahren und neu starten\n\
-f\t\t\tLaufende Anwendungen ohne Warnung schlieáen\n\
\t\t\tWenn Sie keine weiteren Parameter angegeben haben,\n\
\t\t\tmeldet Sie diese Option auch ab"
}

View file

@ -0,0 +1,14 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
STRINGTABLE DISCARDABLE
{
IDS_USAGE, "Usage: shutdown [-?] [-l | -s | -r] [-f]\n\n\
No arguments or -?\tDisplay this message\n\
-l\t\t\tLog off\n\
-s\t\t\tShutdown the computer\n\
-r\t\t\tShutdown and restart the computer\n\
-f\t\t\tForces running applications to close without warnings\n\
\t\t\tIf you did not specify any other parameter, this option\n\
\t\t\twill also log off"
}

View file

@ -0,0 +1,63 @@
#include "precomp.h"
static INT
LengthOfStrResource(IN HINSTANCE hInst,
IN UINT uID)
{
HRSRC hrSrc;
HGLOBAL hRes;
LPWSTR lpName, lpStr;
if (hInst == NULL)
{
return -1;
}
/* There are always blocks of 16 strings */
lpName = (LPWSTR)MAKEINTRESOURCE((uID >> 4) + 1);
/* Find the string table block */
if ((hrSrc = FindResourceW(hInst, lpName, (LPWSTR)RT_STRING)) &&
(hRes = LoadResource(hInst, hrSrc)) &&
(lpStr = (WCHAR*) LockResource(hRes)))
{
UINT x;
/* Find the string we're looking for */
uID &= 0xF; /* position in the block, same as % 16 */
for (x = 0; x < uID; x++)
{
lpStr += (*lpStr) + 1;
}
/* Found the string */
return (int)(*lpStr);
}
return -1;
}
INT
AllocAndLoadString(OUT LPTSTR *lpTarget,
IN HINSTANCE hInst,
IN UINT uID)
{
INT ln;
ln = LengthOfStrResource(hInst,
uID);
if (ln++ > 0)
{
(*lpTarget) = (LPTSTR)LocalAlloc(LMEM_FIXED,
ln * sizeof(TCHAR));
if ((*lpTarget) != NULL)
{
INT Ret;
if (!(Ret = LoadString(hInst, uID, *lpTarget, ln)))
{
LocalFree((HLOCAL)(*lpTarget));
}
return Ret;
}
}
return 0;
}

View file

@ -0,0 +1,16 @@
#ifndef __SHUTDOWN_PRECOMP_H
#define __SHUTDOWN_PRECOMP_H
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <tchar.h>
#include <reason.h> //shutdown codes
#include "resource.h"
// misc.c
INT AllocAndLoadString(OUT LPTSTR *lpTarget,
IN HINSTANCE hInst,
IN UINT uID);
#endif

View file

@ -0,0 +1 @@
#define IDS_USAGE 1000

View file

@ -0,0 +1,5 @@
#include <windows.h>
#include "resource.h"
#include "lang/de-DE.rc"
#include "lang/en-US.rc"

View file

@ -5,23 +5,18 @@
* PURPOSE: Initiate logoff, shutdown or reboot of the system
*/
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <tchar.h>
#include <reason.h> //shutdown codes
#include "precomp.h"
// Print information about which commandline arguments the program accepts.
static void PrintUsage() {
_tprintf(_T("Usage: shutdown [-?] [-l | -s | -r] [-f]\n"));
_tprintf(_T("\n No args or -?\t\tDisplay this message"));
_tprintf(_T("\n -l\t\t\tLog off"));
_tprintf(_T("\n -s\t\t\tShutdown the computer"));
_tprintf(_T("\n -r\t\t\tShutdown and restart the computer"));
_tprintf(_T("\n -f\t\t\tForces running applications to close without warnings"));
_tprintf(_T("\n \t\t\tIf you did not specify any other parameter, this option"));
_tprintf(_T("\n \t\t\twill also log off"));
_tprintf(_T("\n"));
LPTSTR lpUsage = NULL;
if( AllocAndLoadString( &lpUsage,
GetModuleHandle(NULL),
IDS_USAGE ) )
{
_putts( lpUsage );
}
}
struct CommandLineOptions {

View file

@ -7,5 +7,8 @@
<library>advapi32</library>
<library>user32</library>
<library>kernel32</library>
<file>misc.c</file>
<file>shutdown.c</file>
<file>shutdown.rc</file>
<pch>precomp.h</pch>
</module>

View file

@ -0,0 +1,9 @@
#include <windows.h>
#include "resource.h"
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Shutdown Utility\0"
#define REACTOS_STR_INTERNAL_NAME "shutdown\0"
#define REACTOS_STR_ORIGINAL_FILENAME "shutdown.exe\0"
#include <reactos/version.rc>
#include "rsrc.rc"