From 9a217e97c8852bda5a7fdf1cad41da769f013fef Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Sat, 12 Feb 2011 02:07:39 +0100 Subject: Change the way translations are done. * Require gettext-tools to build. * Depend on libintl on Win32. --- src/ld-window-main.c | 72 +++++++++++++++++++++++++++------------------------- src/logdiag.c | 3 +-- 2 files changed, 38 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/ld-window-main.c b/src/ld-window-main.c index 0c671ed..463f2ef 100644 --- a/src/ld-window-main.c +++ b/src/ld-window-main.c @@ -110,61 +110,61 @@ static void on_action_normal_size (GtkAction *action, LdWindowMain *self); /* Actions for menus, toolbars, accelerators. */ static GtkActionEntry wm_action_entries[] = { - {"FileMenu", NULL, Q_("_File"), NULL, NULL, NULL}, - {"New", GTK_STOCK_NEW, Q_("_New"), "N", - Q_("Create a new diagram"), + {"FileMenu", NULL, N_("_File"), NULL, NULL, NULL}, + {"New", GTK_STOCK_NEW, N_("_New"), "N", + N_("Create a new diagram"), G_CALLBACK (on_action_new)}, - {"Open", GTK_STOCK_OPEN, Q_("_Open..."), "O", - Q_("Open a diagram"), + {"Open", GTK_STOCK_OPEN, N_("_Open..."), "O", + N_("Open a diagram"), G_CALLBACK (on_action_open)}, - {"Save", GTK_STOCK_SAVE, Q_("_Save"), "S", - Q_("Save the current diagram"), + {"Save", GTK_STOCK_SAVE, N_("_Save"), "S", + N_("Save the current diagram"), G_CALLBACK (on_action_save)}, - {"SaveAs", GTK_STOCK_SAVE_AS, Q_("Save _As..."), "S", - Q_("Save the current diagram with another name"), + {"SaveAs", GTK_STOCK_SAVE_AS, N_("Save _As..."), "S", + N_("Save the current diagram with another name"), G_CALLBACK (on_action_save_as)}, /* - * {"Export", NULL, Q_("_Export"), NULL, - * Q_("Export the diagram"), + * {"Export", NULL, N_("_Export"), NULL, + * N_("Export the diagram"), * NULL}, */ - {"Quit", GTK_STOCK_QUIT, Q_("_Quit"), "Q", - Q_("Quit the application"), + {"Quit", GTK_STOCK_QUIT, N_("_Quit"), "Q", + N_("Quit the application"), G_CALLBACK (on_action_quit)}, - {"EditMenu", NULL, Q_("_Edit"), NULL, NULL, NULL}, - {"Undo", GTK_STOCK_UNDO, Q_("_Undo"), "Z", - Q_("Undo the last action"), + {"EditMenu", NULL, N_("_Edit"), NULL, NULL, NULL}, + {"Undo", GTK_STOCK_UNDO, N_("_Undo"), "Z", + N_("Undo the last action"), G_CALLBACK (on_action_undo)}, - {"Redo", GTK_STOCK_REDO, Q_("_Redo"), "Z", - Q_("Redo the last undone action"), + {"Redo", GTK_STOCK_REDO, N_("_Redo"), "Z", + N_("Redo the last undone action"), G_CALLBACK (on_action_redo)}, /* - * {"Cut", GTK_STOCK_CUT, Q_("Cu_t"), "X", NULL, NULL}, - * {"Copy", GTK_STOCK_COPY, Q_("_Copy"), "C", NULL, NULL}, - * {"Paste", GTK_STOCK_PASTE, Q_("_Paste"), "V", NULL, NULL}, + * {"Cut", GTK_STOCK_CUT, N_("Cu_t"), "X", NULL, NULL}, + * {"Copy", GTK_STOCK_COPY, N_("_Copy"), "C", NULL, NULL}, + * {"Paste", GTK_STOCK_PASTE, N_("_Paste"), "V", NULL, NULL}, */ - {"Delete", GTK_STOCK_DELETE, Q_("_Delete"), "Delete", - Q_("Delete the contents of the selection"), + {"Delete", GTK_STOCK_DELETE, N_("_Delete"), "Delete", + N_("Delete the contents of the selection"), G_CALLBACK (on_action_delete)}, - {"SelectAll", GTK_STOCK_SELECT_ALL, Q_("Select _All"), "A", - Q_("Select all objects in the diagram"), + {"SelectAll", GTK_STOCK_SELECT_ALL, N_("Select _All"), "A", + N_("Select all objects in the diagram"), G_CALLBACK (on_action_select_all)}, - {"ViewMenu", NULL, Q_("_View"), NULL, NULL, NULL}, - {"ZoomIn", GTK_STOCK_ZOOM_IN, Q_("_Zoom In"), "plus", - Q_("Zoom into the diagram"), + {"ViewMenu", NULL, N_("_View"), NULL, NULL, NULL}, + {"ZoomIn", GTK_STOCK_ZOOM_IN, N_("_Zoom In"), "plus", + N_("Zoom into the diagram"), G_CALLBACK (on_action_zoom_in)}, - {"ZoomOut", GTK_STOCK_ZOOM_OUT, Q_("Zoom _Out"), "minus", - Q_("Zoom out of the diagram"), + {"ZoomOut", GTK_STOCK_ZOOM_OUT, N_("Zoom _Out"), "minus", + N_("Zoom out of the diagram"), G_CALLBACK (on_action_zoom_out)}, - {"NormalSize", GTK_STOCK_ZOOM_100, Q_("_Normal Size"), "0", - Q_("Reset zoom level back to the default"), + {"NormalSize", GTK_STOCK_ZOOM_100, N_("_Normal Size"), "0", + N_("Reset zoom level back to the default"), G_CALLBACK (on_action_normal_size)}, - {"HelpMenu", NULL, Q_("_Help"), NULL, NULL, NULL}, - {"About", GTK_STOCK_ABOUT, Q_("_About"), NULL, - Q_("Show a dialog about this application"), + {"HelpMenu", NULL, N_("_Help"), NULL, NULL, NULL}, + {"About", GTK_STOCK_ABOUT, N_("_About"), NULL, + N_("Show a dialog about this application"), G_CALLBACK (on_action_about)} }; @@ -216,6 +216,8 @@ ld_window_main_init (LdWindowMain *self) G_CALLBACK (on_ui_proxy_disconnected), self); priv->action_group = gtk_action_group_new ("MainActions"); + gtk_action_group_set_translation_domain + (priv->action_group, GETTEXT_DOMAIN); gtk_action_group_add_actions (priv->action_group, wm_action_entries, G_N_ELEMENTS (wm_action_entries), self); gtk_ui_manager_insert_action_group (priv->ui_manager, diff --git a/src/logdiag.c b/src/logdiag.c index 20783b1..8191d7f 100644 --- a/src/logdiag.c +++ b/src/logdiag.c @@ -9,6 +9,7 @@ */ #include +#include #include "config.h" @@ -20,13 +21,11 @@ main (int argc, char *argv[]) { GtkWidget *wnd; -#ifdef HAVE_GETTEXT setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_DOMAIN, GETTEXT_DIRNAME); bind_textdomain_codeset (GETTEXT_DOMAIN, "UTF-8"); textdomain (GETTEXT_DOMAIN); -#endif /* For custom command line arguments, see: * http://git.gnome.org/browse/glade3/tree/src/main.c -- cgit v1.2.3-70-g09d2