aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-12-28 12:16:48 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-12-28 12:16:48 +0800
commita6c6f6d90674cf789a114768f8597086b572ffae (patch)
treedeba09b296186f3695a51cec37ae1a71b394fe6c /shell
parent8e2b445e9dd2ec76be420bfffdf13bbacae14a3e (diff)
downloadgsoc2013-evolution-a6c6f6d90674cf789a114768f8597086b572ffae.tar.gz
gsoc2013-evolution-a6c6f6d90674cf789a114768f8597086b572ffae.tar.zst
gsoc2013-evolution-a6c6f6d90674cf789a114768f8597086b572ffae.zip
Solve a translation issue related to the New menu.
svn path=/branches/kill-bonobo/; revision=36934
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-window.c38
-rw-r--r--shell/e-shell-window.h4
-rw-r--r--shell/test/e-test-shell-module.c4
3 files changed, 38 insertions, 8 deletions
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index af08f4cc4e..a110bad82f 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -727,12 +727,14 @@ e_shell_window_set_safe_mode (EShellWindow *shell_window,
* #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 @@ e_shell_window_register_new_item_actions (EShellWindow *shell_window,
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 @@ e_shell_window_register_new_item_actions (EShellWindow *shell_window,
* #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 @@ e_shell_window_register_new_source_actions (EShellWindow *shell_window,
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);
diff --git a/shell/e-shell-window.h b/shell/e-shell-window.h
index 00887cadea..7543413a5c 100644
--- a/shell/e-shell-window.h
+++ b/shell/e-shell-window.h
@@ -103,12 +103,12 @@ void e_shell_window_set_safe_mode (EShellWindow *shell_window,
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
diff --git a/shell/test/e-test-shell-module.c b/shell/test/e-test-shell-module.c
index 2668396a12..6b2c5c4179 100644
--- a/shell/test/e-test-shell-module.c
+++ b/shell/test/e-test-shell-module.c
@@ -53,7 +53,7 @@ static GtkActionEntry item_entries[] = {
{ "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 @@ static GtkActionEntry source_entries[] = {
{ "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) }