After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 88798 - Internationalization needed for date in GnomeDateEdit
Internationalization needed for date in GnomeDateEdit
Status: RESOLVED NOTABUG
Product: gnome-libs
Classification: Deprecated
Component: libgnomeui
1.4.x
Other Linux
: Normal minor
: ---
Assigned To: gnome-libs Maintainers
gnome-libs Maintainers
Depends on:
Blocks:
 
 
Reported: 2002-07-22 14:43 UTC by Daniel Lacroix
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
The patch for gnome-dateedit.c file (3.02 KB, patch)
2002-07-27 07:59 UTC, Daniel Lacroix
none Details | Review

Description Daniel Lacroix 2002-07-22 14:43:29 UTC
I was writting an application with GnomeDateEdit object when I saw that
date where badly represented for European people like me. Date was
represented like that: mm/dd/yyyy in the date_entry field. I saw in the
code that it was something to develop so here is a patch to apply to
libgnomeui/gnome-dateedit.c :

------------------------------ cut here ------------------------
11a12
> #define __USE_XOPEN
78a80
>         struct tm time;
82,83c84,91
< 	/* FIXME: internationalize this - strftime()*/
< 	g_snprintf (buffer, sizeof(buffer), "%d/%d/%d", month + 1, day, year);
---
>         time.tm_sec  = 0;             /* seconds */
>         time.tm_min  = 0;             /* minutes */
>         time.tm_hour = 0;             /* hours */
>         time.tm_mday = day;           /* day of the month */
>         time.tm_mon  = month;         /* month */
>         time.tm_year = year - 1900;   /* year */
>         strftime (buffer, sizeof(buffer), "%x", &time);
> 
181,185c189,191
<         /* This code is pretty much just copied from
gtk_date_edit_get_date */<       	sscanf (gtk_entry_get_text (GTK_ENTRY
(gde->date_entry)), "%d/%d/%d",
< 		&mtm.tm_mon, &mtm.tm_mday, &mtm.tm_year); /* FIXME: internationalize this -
strptime()*/
< 
< 	mtm.tm_mon = CLAMP (mtm.tm_mon, 1, 12);
---
> 	strptime (gtk_entry_get_text (GTK_ENTRY (gde->date_entry)),
>        		"%x", &mtm);
> 	mtm.tm_mon = CLAMP (mtm.tm_mon, 0, 11);
188,195d193
<         mtm.tm_mon--;
< 
< 	/* Hope the user does not actually mean years early in the A.D. days...
< 	 * This date widget will obviously not work for a history program :-)
< 	 */
< 	if (mtm.tm_year >= 1900)
< 		mtm.tm_year -= 1900;
< 
402,405c400
< 	g_snprintf (buffer, sizeof(buffer), "%d/%d/%d",
< 		    mytm->tm_mon + 1,
< 		    mytm->tm_mday,
< 		    1900 + mytm->tm_year);
---
>         strftime (buffer, sizeof (buffer), "%x", mytm);
582,585c577,579
< 	sscanf (gtk_entry_get_text (GTK_ENTRY (gde->date_entry)), "%d/%d/%d",
< 		&tm.tm_mon, &tm.tm_mday, &tm.tm_year); /* FIXME: internationalize this -
strptime()*/
< 
< 	tm.tm_mon = CLAMP (tm.tm_mon, 1, 12);
---
> 	strptime (gtk_entry_get_text (GTK_ENTRY (gde->date_entry)),
>        		"%x", &tm);
> 	tm.tm_mon = CLAMP (tm.tm_mon, 0, 11);
587,594d580
< 
< 	tm.tm_mon--;
< 
< 	/* Hope the user does not actually mean years early in the A.D. days...
< 	 * This date widget will obviously not work for a history program :-)
< 	 */
< 	if (tm.tm_year >= 1900)
< 		tm.tm_year -= 1900;
------------------------------ cut here ------------------------

I can provide full file if needed. This patch use strftime and strptime to
internationalize. This is at least better than now but I think it is a
little platform dependant and for US date is written like that : mm/dd/yy
whereas for FR it is written like that : dd.mm.yyyy (but in France we
normaly use dd/mm/yyyy). What ever I think it is already an approvement.
Comment 1 Kjartan Maraas 2002-07-25 11:39:02 UTC
Thank you very much. Could you provide the patch as an attachment and
please use -u when creating patches as that makes them so much more
readable.
Comment 2 Daniel Lacroix 2002-07-27 07:59:20 UTC
Created attachment 10084 [details] [review]
The patch for gnome-dateedit.c file
Comment 3 Kjartan Maraas 2002-07-27 16:46:09 UTC
Have you checked gnome-libs-1.4.1.7? This is the latest release and it
doesn't look like the one you worked from. :/
Comment 4 Daniel Lacroix 2002-07-29 19:34:42 UTC
No I haven't use le latest version : gnome-libs-1.4.1.7. My patch was
done with : gnome-libs-1.4.1.2. Is it really necessary to provide a
patch for the 1.4.1.7 version ? If yes, I will but it will be longer.
Comment 5 Kjartan Maraas 2002-07-30 14:15:20 UTC
The problem is that someone else beat you to it. There was a patch for
this in 1.4.1.7, but we are having doubts about that one, and if your
patch is better I'll gladly swap it in the next release. Maybe they
both have stuff that is good and should be merged etc.
Comment 6 Daniel Lacroix 2002-07-30 19:56:49 UTC
I saw this in 1.4.1.7. I think this version is good (even if I not
really try this version). In this version g_date is used. I means that
dates problem are threated in glib. In glib the same function
(strftime and strptime with format %x)is used. So it might be a better
solution. Problem are now part of glib ;)