libgnome/lib_date.c and gettext



lib_date.c has some N_() gettext markings, but never does actual
translation.  Patch appended.

I just added gettext() calls but I wonder...  What is the purpose of
this library?  If a program use lib_date to save gettext()ed string
into a file, that is definitely a bug.  Is gettext really needed for
lib_date ?


$ cvs diff -u lib_date.c
Index: lib_date.c
===================================================================
RCS file: /cvs/gnome/gnome-libs/libgnome/lib_date.c,v
retrieving revision 1.6
diff -u -r1.6 lib_date.c
--- lib_date.c	1998/11/09 00:32:37	1.6
+++ lib_date.c	1998/11/27 17:19:40
@@ -199,7 +199,7 @@
     datestr = (baseptr) malloc(16);
     if (datestr == NULL) return(NULL);
     if (uncompress(date,&cc,&yy,&mm,&dd))
-        sprintf((char *)datestr,"%02d-%.3s-%02d",dd,month_name[mm],yy);
+        sprintf((char *)datestr,"%02d-%.3s-%02d",dd,gettext(month_name[mm]),yy);
     else
         strcpy((char *)datestr,(char *)rsrc_date_001);
     return(datestr);
@@ -393,8 +393,8 @@
     if (datestr == NULL) return(NULL);
     if (check_date(year,mm,dd))
         sprintf((char *)datestr,"%.3s %d-%.3s-%d",
-            day_name[day_of_week(year,mm,dd)],
-            dd,month_name[mm],year);
+            gettext(day_name[day_of_week(year,mm,dd)]),
+            dd,gettext(month_name[mm]),year);
     else
         strcpy((char *)datestr,(char *)rsrc_date_002);
     return(datestr);
@@ -408,8 +408,8 @@
     if (datestr == NULL) return(NULL);
     if (check_date(year,mm,dd))
         sprintf((char *)datestr,"%s, %d %s %d",
-            day_name[day_of_week(year,mm,dd)],
-            dd,month_name[mm],year);
+            gettext(day_name[day_of_week(year,mm,dd)]),
+            dd,gettext(month_name[mm]),year);
     else
         strcpy((char *)datestr,(char *)rsrc_date_003);
     return(datestr);
@@ -502,7 +502,7 @@
         same = true;
         for ( j=0; same and (j<len); j++ )
         {
-            same = ( toupper(buffer[j]) == toupper(day_name[i][j]) );
+            same = ( toupper(buffer[j]) == toupper(gettext(day_name[i][j])) );
         }
         if (same)
         {
@@ -531,7 +531,7 @@
         same = true;
         for ( j=0; same and (j<len); j++ )
         {
-            same = ( toupper(buffer[j]) == toupper(month_name[i][j]) );
+            same = ( toupper(buffer[j]) == toupper(gettext(month_name[i][j])) );
         }
         if (same)
         {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]