aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-10-05 00:57:06 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2000-10-05 00:57:06 +0800
commit98be1e6b098e9f89e9d4bbb135a45c3d255f9103 (patch)
tree0ee36b95ba98a4daff8dc56cda1425b40fc2edd4 /calendar/gui
parent4f4801f4e7ee844e17db9b5bbda4c97910552f47 (diff)
downloadgsoc2013-evolution-98be1e6b098e9f89e9d4bbb135a45c3d255f9103.tar.gz
gsoc2013-evolution-98be1e6b098e9f89e9d4bbb135a45c3d255f9103.tar.zst
gsoc2013-evolution-98be1e6b098e9f89e9d4bbb135a45c3d255f9103.zip
Fix strftime() %a versus %b confusion. Fixes bugzilla #644.
2000-10-04 Federico Mena Quintero <federico@helixcode.com> * gui/print.c (range_selector_new): Fix strftime() %a versus %b confusion. Fixes bugzilla #644. (range_selector_new): Fix the whole localization mess by making better use of strftime(). Now we generate whole date strings at a time and compose them later. Fixes bugzilla #643. svn path=/trunk/; revision=5709
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/print.c52
1 files changed, 14 insertions, 38 deletions
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index 12473d3712..e621951cf1 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -1039,6 +1039,8 @@ range_selector_new (GtkWidget *dialog, time_t at, int *view)
GtkWidget *radio;
GSList *group;
char text[1024];
+ char str1[512];
+ char str2[512];
struct tm tm;
time_t week_begin, week_end;
struct tm week_begin_tm, week_end_tm;
@@ -1062,54 +1064,28 @@ range_selector_new (GtkWidget *dialog, time_t at, int *view)
week_begin_tm = *localtime (&week_begin);
week_end_tm = *localtime (&week_end);
- /* FIXME: how to make this localization-friendly? */
-
if (week_begin_tm.tm_mon == week_end_tm.tm_mon) {
- char month[128];
- char day1[128];
- char day2[128];
-
- strftime (month, sizeof (month), _("%a"), &week_begin_tm);
- strftime (day1, sizeof (day1), _("%b"), &week_begin_tm);
- strftime (day2, sizeof (day2), _("%b"), &week_end_tm);
-
- g_snprintf (text, sizeof (text), _("Current week (%s %s %d - %s %d %d)"),
- day1, month, week_begin_tm.tm_mday,
- day2, week_end_tm.tm_mday,
- week_begin_tm.tm_year + 1900);
+ strftime (str1, sizeof (str1), _("%a %b %d"), &week_begin_tm);
+ strftime (str2, sizeof (str2), _("%a %d %Y"), &week_end_tm);
} else {
- char month1[128];
- char month2[128];
- char day1[128];
- char day2[128];
-
- strftime (month1, sizeof (month1), _("%a"), &week_begin_tm);
- strftime (month2, sizeof (month2), _("%a"), &week_end_tm);
- strftime (day1, sizeof (day1), _("%b"), &week_begin_tm);
- strftime (day2, sizeof (day2), _("%b"), &week_end_tm);
-
- if (week_begin_tm.tm_year == week_end_tm.tm_year)
- g_snprintf (text, sizeof (text),
- _("Current week (%s %s %d - %s %s %d %d)"),
- day1, month1, week_begin_tm.tm_mday,
- day2, month2, week_end_tm.tm_mday,
- week_begin_tm.tm_year + 1900);
- else
- g_snprintf (text, sizeof (text),
- _("Current week (%s %s %d %d - %s %s %d %d)"),
- day1, month1, week_begin_tm.tm_mday,
- week_begin_tm.tm_year + 1900,
- day2, month2, week_end_tm.tm_mday,
- week_end_tm.tm_year + 1900);
+ if (week_begin_tm.tm_year == week_end_tm.tm_year) {
+ strftime (str1, sizeof (str1), _("%a %b %d"), &week_begin_tm);
+ strftime (str2, sizeof (str2), _("%a %b %d %Y"), &week_end_tm);
+ } else {
+ strftime (str1, sizeof (str1), _("%a %b %d %Y"), &week_begin_tm);
+ strftime (str2, sizeof (str2), _("%a %b %d %Y"), &week_end_tm);
+ }
}
+ g_snprintf (text, sizeof (text), _("Current week (%s - %s)"), str1, str2);
+
radio = gtk_radio_button_new_with_label (group, text);
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio));
gtk_box_pack_start (GTK_BOX (box), radio, FALSE, FALSE, 0);
/* Month */
- strftime (text, sizeof (text), _("Current month (%a %Y)"), &tm);
+ strftime (text, sizeof (text), _("Current month (%b %Y)"), &tm);
radio = gtk_radio_button_new_with_label (group, text);
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio));
gtk_box_pack_start (GTK_BOX (box), radio, FALSE, FALSE, 0);