From 8f792acdab7ebcf48b67e3bd4c1dc4603efbedcb Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Tue, 21 Mar 2017 20:32:54 +0000 Subject: [PATCH] [AT] - Retrieve the users short day names instead of hardcoded day names. - Fix resources. svn path=/trunk/; revision=74220 --- reactos/base/applications/cmdutils/at/at.c | 55 ++++++++++++++++++- .../applications/cmdutils/at/lang/de-DE.rc | 4 +- .../applications/cmdutils/at/lang/en-US.rc | 2 +- 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/reactos/base/applications/cmdutils/at/at.c b/reactos/base/applications/cmdutils/at/at.c index 315ed4c3d75..0fe78b8d2d0 100644 --- a/reactos/base/applications/cmdutils/at/at.c +++ b/reactos/base/applications/cmdutils/at/at.c @@ -20,7 +20,55 @@ #include "resource.h" -PWSTR pszDaysOfWeekArray[] = {L"M", L"T", L"W", L"TH", L"F", L"S", L"SU", NULL}; + +PWSTR pszDaysOfWeekArray[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; + + +static +VOID +FreeDaysOfWeekArray(VOID) +{ + INT i; + + for (i = 0; i < 7; i++) + { + if (pszDaysOfWeekArray[i] != NULL) + HeapFree(GetProcessHeap(), 0, pszDaysOfWeekArray[i]); + } +} + + +static +BOOL +InitDaysOfWeekArray(VOID) +{ + INT i, nLength; + + for (i = 0; i < 7; i++) + { + nLength = GetLocaleInfo(LOCALE_USER_DEFAULT, + LOCALE_SABBREVDAYNAME1 + i, + NULL, + 0); + + pszDaysOfWeekArray[i] = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + nLength * sizeof(WCHAR)); + if (pszDaysOfWeekArray[i] == NULL) + { + FreeDaysOfWeekArray(); + return FALSE; + } + + GetLocaleInfo(LOCALE_USER_DEFAULT, + LOCALE_SABBREVDAYNAME1 + i, + pszDaysOfWeekArray[i], + nLength); + } + + return TRUE; +} + static BOOL @@ -572,6 +620,9 @@ int wmain(int argc, WCHAR **argv) /* Initialize the Console Standard Streams */ ConInitStdStreams(); + if (!InitDaysOfWeekArray()) + return 1; + /* Parse the computer name */ i = 1; minIdx = 1; @@ -726,6 +777,8 @@ int wmain(int argc, WCHAR **argv) } done: + FreeDaysOfWeekArray(); + if (bPrintUsage == TRUE) ConResPuts(StdOut, IDS_USAGE); diff --git a/reactos/base/applications/cmdutils/at/lang/de-DE.rc b/reactos/base/applications/cmdutils/at/lang/de-DE.rc index ce24ccd42e0..7b476cd7438 100644 --- a/reactos/base/applications/cmdutils/at/lang/de-DE.rc +++ b/reactos/base/applications/cmdutils/at/lang/de-DE.rc @@ -18,7 +18,7 @@ Zeit Gibt die Zeit an, zu der ein Befehl ausgeführt werden soll.\ /NEXT:Datum[,...] ...\n\ ""Befehl"" Ist der auszuführende Befehl oder das Stapelprogramm.\n" - IDS_CONFIRM_DELETE "Dieser Vorgang wird alle geplanten Aufräge löschen.\nMöchten Sie diesen Vorgang fortsetzen? (J/N) [N]" + IDS_CONFIRM_DELETE "Dieser Vorgang wird alle geplanten Aufräge löschen.\nMöchten Sie diesen Vorgang fortsetzen? (J/N) [N] " IDS_NEW_JOB "Neuer Auftrag hinzugefügt. Kennung = %lu\n" IDS_JOBS_LIST "Statuskenn. Tag Zeit Befehlszeile\n" IDS_NO_ENTRIES "Es sind keine Einträge in der Liste.\n" @@ -26,7 +26,7 @@ Zeit Gibt die Zeit an, zu der ein Befehl ausgeführt werden soll.\ IDS_TODAY "Heute" IDS_TOMORROW "Morgen" IDS_EVERY "Jeden" - IDS_NEXT "Nächsten" + IDS_NEXT "Kommenden" IDS_YES "Ja" IDS_NO "Nein" diff --git a/reactos/base/applications/cmdutils/at/lang/en-US.rc b/reactos/base/applications/cmdutils/at/lang/en-US.rc index 6bc6f198188..ceda21b9d49 100644 --- a/reactos/base/applications/cmdutils/at/lang/en-US.rc +++ b/reactos/base/applications/cmdutils/at/lang/en-US.rc @@ -27,7 +27,7 @@ Zeit Specifies the time when command is to run.\n\ current day of the month is assumed.\n\ ""command"" Is the command or batch program to be run.\n" - IDS_CONFIRM_DELETE "This operation will delete all seduled jobs.\nDo you want to continue this operation? (Y/N) [N]: " + IDS_CONFIRM_DELETE "This operation will delete all seduled jobs.\nDo you want to continue this operation? (Y/N) [N] " IDS_NEW_JOB "Added a new job with job ID = %lu\n" IDS_JOBS_LIST "Status ID Day Time Command Line\n" IDS_NO_ENTRIES "There are no entries in the list.\n"