[Fwd: [evolution-patches] don't split sentences in a11y calendar code (71924, 71926, 71932)]



Hi,
The attached patch was committed into CVS HEAD for module "evolution". It includes some string changes.
Thanks!
Harry Lu
--- Begin Message --- JP and Rodrigo,
Attached is the patch for those 3 i18n a11y bugs in calendar. Please review it.
Thanks!
Harry
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/a11y/ChangeLog,v
retrieving revision 1.30
diff -u -r1.30 ChangeLog
--- ChangeLog	31 Jan 2005 14:42:52 -0000	1.30
+++ ChangeLog	1 Feb 2005 08:51:20 -0000
@@ -1,3 +1,16 @@
+2005-02-01  Harry Lu <harry lu sun com>
+
+	Fix for 71924, 71926, 71932 
+	Don't split sentences that need translation.
+	Also remove two useless variables.
+
+	* calendar/ea-cal-view-event.c: (ea_cal_view_event_get_name):
+	* calendar/ea-day-view.c: (ea_day_view_get_name):
+	* calendar/ea-week-view.c: (ea_week_view_get_name),
+	(ea_week_view_get_n_children):
+	* widgets/ea-calendar-item.c: (ea_calendar_item_get_name),
+	(e_calendar_item_get_offset_for_date):
+
 2005-01-31  Rodrigo Moya <rodrigo novell com>
 
 	Fixes #71929
Index: calendar/ea-cal-view-event.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-cal-view-event.c,v
retrieving revision 1.10
diff -u -r1.10 ea-cal-view-event.c
--- calendar/ea-cal-view-event.c	30 Sep 2004 07:32:36 -0000	1.10
+++ calendar/ea-cal-view-event.c	1 Feb 2005 08:51:22 -0000
@@ -216,8 +216,8 @@
 	AtkGObjectAccessible *atk_gobj;
 	GObject *g_obj;
 	ECalendarViewEvent *event;
-	gchar *tmp_name;
-	gchar *new_name = g_strdup ("");
+	gchar *name_string;
+	gchar *alarm_string, *recur_string, *meeting_string, *summary_string;
         const char *summary;
 
 
@@ -229,53 +229,33 @@
 		return NULL;
 	event = ea_calendar_helpers_get_cal_view_event_from (GNOME_CANVAS_ITEM(g_obj));
 
+	alarm_string = recur_string = meeting_string = "";
 	if (event && event->comp_data) {
-		if (e_cal_util_component_has_alarms (event->comp_data->icalcomp)) {
-			tmp_name = new_name;
-			new_name = g_strconcat (new_name, _("alarm "), NULL);
-			g_free (tmp_name);
-		}
-
-		if (e_cal_util_component_has_recurrences (event->comp_data->icalcomp)) {
-			tmp_name = new_name;
-			new_name = g_strconcat (new_name, _("recurrence "), NULL);
-			g_free (tmp_name);
-		}
-
-		if (event->different_timezone) {
-			tmp_name = new_name;
-			new_name = g_strconcat (new_name, _("time-zone "), NULL);
-			g_free (tmp_name);
-		}
-
-		if (e_cal_util_component_has_organizer (event->comp_data->icalcomp)) {
-			tmp_name = new_name;
-			new_name = g_strconcat (new_name, _("meeting "), NULL);
-			g_free (tmp_name);
-		}
+		if (e_cal_util_component_has_alarms (event->comp_data->icalcomp)) 
+			alarm_string = _("It has alarms.");
+
+		if (e_cal_util_component_has_recurrences (event->comp_data->icalcomp)) 
+			recur_string = _("It has recurrences.");
+
+		if (e_cal_util_component_has_organizer (event->comp_data->icalcomp)) 
+			meeting_string = _("It is a meeting.");
+			
 	}
-	tmp_name = new_name;
-	new_name = g_strconcat (new_name, _("event. Summary is "), NULL);
-	g_free (tmp_name);
 
 	summary = icalcomponent_get_summary (event->comp_data->icalcomp);
-	if (summary) {
-		tmp_name = new_name;
-		new_name = g_strconcat (new_name, summary, NULL);
-		g_free (tmp_name);
-	}
-	else {
-		tmp_name = new_name;
-		new_name = g_strconcat (new_name, _("empty"), NULL);
-		g_free (tmp_name);
-	}
+	if (summary) 
+		summary_string = g_strdup_printf (_("Calendar Event: Summary is %s."), summary);
+	else 
+		summary_string = g_strdup (_("Calendar Event: It has no summary."));
+
+	name_string = g_strdup_printf ("%s %s %s %s", summary_string, alarm_string, recur_string, meeting_string);
 
-	ATK_OBJECT_CLASS (parent_class)->set_name (accessible, new_name);
+	ATK_OBJECT_CLASS (parent_class)->set_name (accessible, name_string);
 #ifdef ACC_DEBUG
 	printf("EvoAcc:  name for event accobj=%p, is %s\n",
 	       (void *)accessible, new_name);
 #endif
-	g_free (new_name);
+	g_free (name_string);
 	return accessible->name;
 }
 
Index: calendar/ea-day-view.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-day-view.c,v
retrieving revision 1.8
diff -u -r1.8 ea-day-view.c
--- calendar/ea-day-view.c	31 Jan 2005 14:42:52 -0000	1.8
+++ calendar/ea-day-view.c	1 Feb 2005 08:51:22 -0000
@@ -127,16 +127,15 @@
 	GnomeCalendar *gcal;
 	const gchar *label_text;
 	GnomeCalendarViewType view_type;
-	gchar buffer[128] = "";
 	gint n_events;
-
+	gchar *event_str, *name_str;
 
 	g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), NULL);
 
 	if (!GTK_ACCESSIBLE (accessible)->widget)
 		return NULL;
-	day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
 
+	day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
 	gcal = e_calendar_view_get_calendar (E_CALENDAR_VIEW (day_view));
 	label_text = ea_gnome_calendar_get_label_description (gcal);
 
@@ -144,16 +143,22 @@
 	/* the child main item is always there */
 	--n_events;
 	if (n_events >= 1)
-		g_snprintf (buffer, sizeof (buffer), ngettext ( _(", %d event"), _(", %d events"), n_events), n_events);
+		event_str = g_strdup_printf (ngettext ("It has %d event.", "It has %d events.", n_events), n_events);
+	else
+		event_str = g_strdup (_("It has no events."));
+
 	view_type = gnome_calendar_get_view (gcal);
 	if (view_type == GNOME_CAL_WORK_WEEK_VIEW)
-		accessible->name = g_strconcat (_("work week view:"),
-						label_text, buffer,
-						NULL);
+		name_str = g_strdup_printf (_("Work Week View: %s. %s"),
+						label_text, event_str);
 	else
-		accessible->name = g_strconcat (_("day view:"),
-						label_text, buffer,
-						NULL);
+		name_str = g_strdup_printf (_("Day View: %s. %s"),
+						label_text, event_str);
+
+	ATK_OBJECT_CLASS (parent_class)->set_name (accessible, name_str);
+	g_free (name_str);
+	g_free (event_str);
+
 	return accessible->name;
 }
 
Index: calendar/ea-week-view.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-week-view.c,v
retrieving revision 1.11
diff -u -r1.11 ea-week-view.c
--- calendar/ea-week-view.c	31 Jan 2005 14:42:52 -0000	1.11
+++ calendar/ea-week-view.c	1 Feb 2005 08:51:23 -0000
@@ -129,15 +129,15 @@
 	GnomeCalendar *gcal;
 	const gchar *label_text;
 	GnomeCalendarViewType view_type;
-	gchar buffer[128] = "";
 	gint n_events;
+	gchar *event_str, *name_str;
 
 	g_return_val_if_fail (EA_IS_WEEK_VIEW (accessible), NULL);
 
 	if (!GTK_ACCESSIBLE (accessible)->widget)
 		return NULL;
-	week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
 
+	week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
 	gcal = e_calendar_view_get_calendar (E_CALENDAR_VIEW (week_view));
 	label_text = ea_gnome_calendar_get_label_description (gcal);
 
@@ -145,19 +145,24 @@
 	/* the child main item is always there */
 	--n_events;
 	if (n_events >= 1)
-		g_snprintf (buffer, sizeof (buffer), ngettext ( _(", %d event"), _(", %d events"), n_events), n_events);
+		event_str = g_strdup_printf (ngettext ("It has %d event.", "It has %d events.", n_events), n_events);
+	else
+		event_str = g_strdup (_("It has no events."));
 
 	view_type = gnome_calendar_get_view (gcal);
 
 	if (view_type == GNOME_CAL_MONTH_VIEW)
-		accessible->name = g_strconcat (_("month view:"),
-						label_text, buffer,
-						NULL);
+		name_str = g_strdup_printf (_("Month View: %s. %s"),
+						label_text, event_str);
 
 	else
-		accessible->name = g_strconcat (_("week view:"),
-						label_text, buffer,
-						NULL);
+		name_str = g_strdup_printf (_("Week View: %s. %s"),
+						label_text, event_str);
+
+	ATK_OBJECT_CLASS (parent_class)->set_name (accessible, name_str);
+	g_free (name_str);
+	g_free (event_str);
+
 	return accessible->name;
 }
 
@@ -192,7 +197,6 @@
 ea_week_view_get_n_children (AtkObject *accessible)
 {
 	EWeekView *week_view;
-	GnomeCanvasGroup *canvas_group;
 	gint i, count = 0;
 	gint event_index;
 
Index: widgets/ea-calendar-item.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/widgets/ea-calendar-item.c,v
retrieving revision 1.5
diff -u -r1.5 ea-calendar-item.c
--- widgets/ea-calendar-item.c	30 Sep 2004 07:32:36 -0000	1.5
+++ widgets/ea-calendar-item.c	1 Feb 2005 08:51:25 -0000
@@ -267,17 +267,14 @@
 	ECalendarItem *calitem;
 	gint start_year, start_month, start_day;
 	gint end_year, end_month, end_day;
-	static gchar new_name[256] = "";
-        gchar buffer_start[128] = "";
-        gchar buffer_end[128] = "";
-        struct tm day_start = { 0 };
-        struct tm day_end = { 0 };
+	gchar *name_str = NULL;
+	gchar buffer_start[128] = "";
+	gchar buffer_end[128] = "";
+	struct tm day_start = { 0 };
+	struct tm day_end = { 0 };
 
 	g_return_val_if_fail (EA_IS_CALENDAR_ITEM (accessible), NULL);
 
-	if (accessible->name)
-		return accessible->name;
-
 	g_obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE(accessible));
 	g_return_val_if_fail (E_IS_CALENDAR_ITEM (g_obj), NULL);
 
@@ -290,19 +287,15 @@
                 day_start.tm_mon = start_month;
                 day_start.tm_mday = start_day;
                 day_start.tm_isdst = -1;
-                e_utf8_strftime (buffer_start, sizeof (buffer_start), _(" %d %B %Y"), &day_start);
+                e_utf8_strftime (buffer_start, sizeof (buffer_start), _("%d %B %Y"), &day_start);
 
                 day_end.tm_year = end_year - 1900;
                 day_end.tm_mon = end_month;
                 day_end.tm_mday = end_day;
                 day_end.tm_isdst = -1;
-                e_utf8_strftime (buffer_end, sizeof (buffer_end), _(" %d %B %Y"), &day_end);
+                e_utf8_strftime (buffer_end, sizeof (buffer_end), _("%d %B %Y"), &day_end);
 
-                strcat (new_name, _("calendar (from "));
-                strcat (new_name, buffer_start);
-                strcat (new_name, _(" to "));
-                strcat (new_name, buffer_end);
-                strcat (new_name, _(")"));
+		name_str = g_strdup_printf (_("Calendar: from %s to %s"), buffer_start, buffer_end); 
         }
 
 #if 0
@@ -325,7 +318,10 @@
 	}
 #endif
 
-	return new_name;
+	ATK_OBJECT_CLASS (parent_class)->set_name (accessible, name_str);
+	g_free (name_str);
+
+	return accessible->name;
 }
 
 static G_CONST_RETURN gchar*
@@ -1264,7 +1260,6 @@
 	gint start_year, start_month, start_day;
 	gint end_year, end_month, end_day;
 	GDate *start_date, *end_date;
-	gint n_days;
 
 	*offset = 0;
 	g_return_val_if_fail (E_IS_CALENDAR_ITEM (calitem), FALSE);

--- End Message ---


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