evolution r36934 - in branches/kill-bonobo: addressbook/gui/component calendar/modules mail shell shell/test



Author: mbarnes
Date: Sun Dec 28 04:16:48 2008
New Revision: 36934
URL: http://svn.gnome.org/viewvc/evolution?rev=36934&view=rev

Log:
Solve a translation issue related to the New menu.


Modified:
   branches/kill-bonobo/addressbook/gui/component/e-book-shell-module.c
   branches/kill-bonobo/calendar/modules/e-cal-shell-module.c
   branches/kill-bonobo/calendar/modules/e-memo-shell-module.c
   branches/kill-bonobo/calendar/modules/e-task-shell-module.c
   branches/kill-bonobo/mail/e-mail-reader.c
   branches/kill-bonobo/mail/e-mail-shell-module.c
   branches/kill-bonobo/shell/e-shell-window.c
   branches/kill-bonobo/shell/e-shell-window.h
   branches/kill-bonobo/shell/test/e-test-shell-module.c

Modified: branches/kill-bonobo/addressbook/gui/component/e-book-shell-module.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/component/e-book-shell-module.c	(original)
+++ branches/kill-bonobo/addressbook/gui/component/e-book-shell-module.c	Sun Dec 28 04:16:48 2008
@@ -288,7 +288,7 @@
 
 	{ "contact-new",
 	  "contact-new",
-	  N_("_Contact"),  /* XXX Need C_() here */
+	  NC_("New", "_Contact"),
 	  "<Shift><Control>c",
 	  N_("Create a new contact"),
 	  G_CALLBACK (action_contact_new_cb) },
@@ -305,7 +305,7 @@
 
 	{ "address-book-new",
 	  "address-book-new",
-	  N_("Address _Book"),
+	  NC_("New", "Address _Book"),
 	  NULL,
 	  N_("Create a new address book"),
 	  G_CALLBACK (action_address_book_new_cb) }

Modified: branches/kill-bonobo/calendar/modules/e-cal-shell-module.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-cal-shell-module.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-cal-shell-module.c	Sun Dec 28 04:16:48 2008
@@ -376,21 +376,21 @@
 
 	{ "event-new",
 	  "appointment-new",
-	  N_("_Appointment"),  /* XXX Need C_() here */
+	  NC_("New", "_Appointment"),
 	  "<Control>a",
 	  N_("Create a new appointment"),
 	  G_CALLBACK (action_event_new_cb) },
 
 	{ "event-all-day-new",
 	  "stock_new-24h-appointment",
-	  N_("All Day A_ppointment"),
+	  NC_("New", "All Day A_ppointment"),
 	  NULL,
 	  N_("Create a new all-day appointment"),
 	  G_CALLBACK (action_event_new_cb) },
 
 	{ "event-meeting-new",
 	  "stock_new-meeting",
-	  N_("M_eeting"),
+	  NC_("New", "M_eeting"),
 	  "<Control>e",
 	  N_("Create a new meeting request"),
 	  G_CALLBACK (action_event_new_cb) }
@@ -400,7 +400,7 @@
 
 	{ "calendar-new",
 	  "x-office-calendar",
-	  N_("Cale_ndar"),
+	  NC_("New", "Cale_ndar"),
 	  NULL,
 	  N_("Create a new calendar"),
 	  G_CALLBACK (action_calendar_new_cb) }

Modified: branches/kill-bonobo/calendar/modules/e-memo-shell-module.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-memo-shell-module.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-memo-shell-module.c	Sun Dec 28 04:16:48 2008
@@ -282,7 +282,7 @@
 
 	{ "memo-new",
 	  "stock_insert-note",
-	  N_("Mem_o"),  /* XXX Need C_() here */
+	  NC_("New", "Mem_o"),
 	  "<Shift><Control>o",
 	  N_("Create a new memo"),
 	  G_CALLBACK (action_memo_new_cb) },
@@ -299,7 +299,7 @@
 
 	{ "memo-list-new",
 	  "stock_notes",
-	  N_("Memo Li_st"),
+	  NC_("New", "Memo Li_st"),
 	  NULL,
 	  N_("Create a new memo list"),
 	  G_CALLBACK (action_memo_list_new_cb) }

Modified: branches/kill-bonobo/calendar/modules/e-task-shell-module.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-task-shell-module.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-task-shell-module.c	Sun Dec 28 04:16:48 2008
@@ -282,7 +282,7 @@
 
 	{ "task-new",
 	  "stock_task",
-	  N_("_Task"),  /* XXX Need C_() here */
+	  NC_("New", "_Task"),
 	  "<Shift><Control>t",
 	  N_("Create a new task"),
 	  G_CALLBACK (action_task_new_cb) },
@@ -299,7 +299,7 @@
 
 	{ "task-list-new",
 	  "stock_todo",
-	  N_("Tas_k List"),
+	  NC_("New", "Tas_k List"),
 	  NULL,
 	  N_("Create a new task list"),
 	  G_CALLBACK (action_task_list_new_cb) }

Modified: branches/kill-bonobo/mail/e-mail-reader.c
==============================================================================
--- branches/kill-bonobo/mail/e-mail-reader.c	(original)
+++ branches/kill-bonobo/mail/e-mail-reader.c	Sun Dec 28 04:16:48 2008
@@ -1521,7 +1521,7 @@
 	action = gtk_action_group_get_action (action_group, "mail-previous");
 	g_object_set (action, "short-label", _("Previous"), NULL);
 
-	action = gtk_action_group_get_action (action_group, "mail-reply");
+	action = gtk_action_group_get_action (action_group, "mail-reply-sender");
 	g_object_set (action, "short-label", _("Reply"), NULL);
 
 	/* Connect signals. */

Modified: branches/kill-bonobo/mail/e-mail-shell-module.c
==============================================================================
--- branches/kill-bonobo/mail/e-mail-shell-module.c	(original)
+++ branches/kill-bonobo/mail/e-mail-shell-module.c	Sun Dec 28 04:16:48 2008
@@ -459,7 +459,7 @@
 
 	{ "mail-message-new",
 	  "mail-message-new",
-	  N_("_Mail Message"),  /* XXX C_() here */
+	  NC_("New", "_Mail Message"),
 	  "<Shift><Control>m",
 	  N_("Compose a new mail message"),
 	  G_CALLBACK (action_mail_message_new_cb) }
@@ -469,7 +469,7 @@
 
 	{ "mail-folder-new",
 	  "folder-new",
-	  N_("Mail _Folder"),
+	  NC_("New", "Mail _Folder"),
 	  NULL,
 	  N_("Create a new mail folder"),
 	  G_CALLBACK (action_mail_folder_new_cb) }

Modified: branches/kill-bonobo/shell/e-shell-window.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window.c	(original)
+++ branches/kill-bonobo/shell/e-shell-window.c	Sun Dec 28 04:16:48 2008
@@ -727,12 +727,14 @@
  * #EShellModuleInfo).
  *
  * The registered #GtkAction<!-- -->s should be for creating individual
- * items such as an email message or a calendar appointment.
+ * items such as an email message or a calendar appointment.  The action
+ * labels should be marked for translation with the "New" context using
+ * the NC_() macro.
  **/
 void
 e_shell_window_register_new_item_actions (EShellWindow *shell_window,
                                           const gchar *module_name,
-                                          const GtkActionEntry *entries,
+                                          GtkActionEntry *entries,
                                           guint n_entries)
 {
 	GtkActionGroup *action_group;
@@ -749,6 +751,19 @@
 	accel_group = gtk_ui_manager_get_accel_group (ui_manager);
 	module_name = g_intern_string (module_name);
 
+	/* XXX The action label translations are retrieved from the
+	 *     message context "New", but gtk_action_group_add_actions()
+	 *     does not support message contexts.  So we have to fetch
+	 *     the label translations ourselves before adding them to
+	 *     the action group.
+	 *
+	 *     gtk_action_group_set_translate_func() does not help here
+	 *     because the action tooltips do not use a message context
+	 *     (though I suppose they could). */
+	for (ii = 0; ii < n_entries; ii++)
+		entries[ii].label = g_dpgettext2 (
+			GETTEXT_PACKAGE, "New", entries[ii].label);
+
 	gtk_action_group_add_actions (
 		action_group, entries, n_entries, shell_window);
 
@@ -801,12 +816,14 @@
  * #EShellModuleInfo).
  *
  * The registered #GtkAction<!-- -->s should be for creating item
- * containers such as an email folder or a calendar.
+ * containers such as an email folder or a calendar.  The action labels
+ * should be marked for translation with the "New" context using the
+ * NC_() macro.
  **/
 void
 e_shell_window_register_new_source_actions (EShellWindow *shell_window,
                                             const gchar *module_name,
-                                            const GtkActionEntry *entries,
+                                            GtkActionEntry *entries,
                                             guint n_entries)
 {
 	GtkActionGroup *action_group;
@@ -823,6 +840,19 @@
 	accel_group = gtk_ui_manager_get_accel_group (ui_manager);
 	module_name = g_intern_string (module_name);
 
+	/* XXX The action label translations are retrieved from the
+	 *     message context "New", but gtk_action_group_add_actions()
+	 *     does not support message contexts.  So we have to fetch
+	 *     the label translations ourselves before adding them to
+	 *     the action group.
+	 *
+	 *     gtk_action_group_set_translate_func() does not help here
+	 *     because the action tooltips do not use a message context
+	 *     (though I suppose they could). */
+	for (ii = 0; ii < n_entries; ii++)
+		entries[ii].label = g_dpgettext2 (
+			GETTEXT_PACKAGE, "New", entries[ii].label);
+
 	gtk_action_group_add_actions (
 		action_group, entries, n_entries, shell_window);
 

Modified: branches/kill-bonobo/shell/e-shell-window.h
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window.h	(original)
+++ branches/kill-bonobo/shell/e-shell-window.h	Sun Dec 28 04:16:48 2008
@@ -103,12 +103,12 @@
 void		e_shell_window_register_new_item_actions
 						(EShellWindow *shell_window,
 						 const gchar *module_name,
-						 const GtkActionEntry *entries,
+						 GtkActionEntry *entries,
 						 guint n_entries);
 void		e_shell_window_register_new_source_actions
 						(EShellWindow *shell_window,
 						 const gchar *module_name,
-						 const GtkActionEntry *entries,
+						 GtkActionEntry *entries,
 						 guint n_entries);
 
 G_END_DECLS

Modified: branches/kill-bonobo/shell/test/e-test-shell-module.c
==============================================================================
--- branches/kill-bonobo/shell/test/e-test-shell-module.c	(original)
+++ branches/kill-bonobo/shell/test/e-test-shell-module.c	Sun Dec 28 04:16:48 2008
@@ -53,7 +53,7 @@
 
 	{ "test-item-new",
 	  "document-new",
-	  N_("_Test Item"),
+	  NC_("New", "_Test Item"),
 	  NULL,
 	  N_("Create a new test item"),
 	  G_CALLBACK (action_test_item_new_cb) }
@@ -63,7 +63,7 @@
 
 	{ "test-source-new",
 	  "folder-new",
-	  N_("Test _Source"),
+	  NC_("New", "Test _Source"),
 	  NULL,
 	  N_("Create a new test source"),
 	  G_CALLBACK (action_test_source_new_cb) }



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