changeset 1591:c5e210e04dce

Attempt at localizing the calendar widget on OS/2.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 14 Feb 2012 00:31:18 +0000
parents 9eef6f82ee50
children 1795bd78207d
files os2/dw.c
diffstat 1 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/os2/dw.c	Mon Jan 30 17:36:12 2012 +0000
+++ b/os2/dw.c	Tue Feb 14 00:31:18 2012 +0000
@@ -1709,13 +1709,15 @@
     return rclPaint;
 }
 
+/* These will be filled in during dw_init() */
+static char months[12][20];
+static char daysofweek[7][20];
+
 /* This procedure handles drawing of a status border */
 MRESULT EXPENTRY _calendarproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 {
    /* How many days are in each month usually (not including leap years) */
    static int days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-   static char *months[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
-   static char *daysofweek[] = { "Sunday", "Monday", "Tuesday","Wednesday", "Thursday", "Friday", "Saturday" };
    WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
    PFNWP oldproc = 0;
 
@@ -3962,6 +3964,8 @@
 {
    APIRET rc;
    char objnamebuf[300] = "";
+   int x;
+   struct tm thistm = { 0 };
 
    /* Setup the private data directory */
    if(argc > 0 && argv[0])
@@ -3990,6 +3994,18 @@
    rc = WinRegisterClass(dwhab, (PSZ)ScrollClassName, _scrollwndproc, 0L, 32);
    rc = WinRegisterClass(dwhab, (PSZ)CalendarClassName, _calendarproc, 0L, 32);
 
+   /* Fill in the the calendar fields */
+   for(x=0;x<7;x++)
+   {
+	   thistm.tm_wday = x;
+       strftime(daysofweek[x], 19, "%A", &thistm);
+   }
+   for(x=0;x<12;x++)
+   {
+	   thistm.tm_mon = x;
+       strftime(months[x], 19, "%B", &thistm);
+   }
+
    /* Get the OS/2 version. */
    DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)aulBuffer, 4*sizeof(ULONG));