Commit 7331de667a3f6e9dd3e5f719ac744e70b3ab8ef8
1 parent
ca045eab
Exists in
master
and in
4 other branches
Adding i18n support on the new toolbar.
Showing
3 changed files
with
65 additions
and
19 deletions
Show diff stats
src/widgets/toolbar/core.c
| ... | ... | @@ -27,9 +27,7 @@ |
| 27 | 27 | * |
| 28 | 28 | */ |
| 29 | 29 | |
| 30 | - #include <config.h> | |
| 31 | - #include <pw3270/toolbar.h> | |
| 32 | - #include <lib3270/log.h> | |
| 30 | + #include "private.h" | |
| 33 | 31 | |
| 34 | 32 | static gboolean popup_context_menu(GtkToolbar *toolbar, gint x, gint y, gint button_number); |
| 35 | 33 | static void finalize(GObject *object); |
| ... | ... | @@ -103,24 +101,24 @@ |
| 103 | 101 | } itens[] = { |
| 104 | 102 | |
| 105 | 103 | { |
| 106 | - .label = "Default" | |
| 104 | + .label = N_( "Default" ) | |
| 107 | 105 | |
| 108 | 106 | }, |
| 109 | 107 | |
| 110 | 108 | { |
| 111 | - .label = "Small", | |
| 109 | + .label = N_( "Small" ), | |
| 112 | 110 | .icon_size = GTK_ICON_SIZE_SMALL_TOOLBAR |
| 113 | 111 | }, |
| 114 | 112 | |
| 115 | 113 | { |
| 116 | - .label = "Large", | |
| 114 | + .label = N_( "Large" ), | |
| 117 | 115 | .icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR |
| 118 | 116 | }, |
| 119 | 117 | }; |
| 120 | 118 | |
| 121 | 119 | size_t ix; |
| 122 | 120 | |
| 123 | - GtkWidget * item = gtk_menu_item_new_with_mnemonic("Icon _size"); | |
| 121 | + GtkWidget * item = gtk_menu_item_new_with_mnemonic( _("Icon _size") ); | |
| 124 | 122 | gtk_menu_shell_append(GTK_MENU_SHELL(widget->popup_menu),item); |
| 125 | 123 | |
| 126 | 124 | GtkWidget * submenu = gtk_menu_new(); |
| ... | ... | @@ -128,7 +126,7 @@ |
| 128 | 126 | |
| 129 | 127 | for(ix = 0; ix < G_N_ELEMENTS(itens); ix++) { |
| 130 | 128 | |
| 131 | - item = gtk_menu_item_new_with_mnemonic(itens[ix].label); | |
| 129 | + item = gtk_menu_item_new_with_mnemonic(gettext(itens[ix].label)); | |
| 132 | 130 | |
| 133 | 131 | if(ix > 0) |
| 134 | 132 | g_object_set_data(G_OBJECT(item),"icon_size", (gpointer) &itens[ix].icon_size); |
| ... | ... | @@ -149,28 +147,28 @@ |
| 149 | 147 | } itens[] = { |
| 150 | 148 | |
| 151 | 149 | { |
| 152 | - .label = "Default" | |
| 150 | + .label = N_( "Default" ) | |
| 153 | 151 | }, |
| 154 | 152 | |
| 155 | 153 | { |
| 156 | - .label = "Icons only", | |
| 154 | + .label = N_( "Icons only" ), | |
| 157 | 155 | .style = GTK_TOOLBAR_ICONS |
| 158 | 156 | }, |
| 159 | 157 | |
| 160 | 158 | { |
| 161 | - .label = "Text only", | |
| 159 | + .label = N_( "Text only" ), | |
| 162 | 160 | .style = GTK_TOOLBAR_TEXT |
| 163 | 161 | }, |
| 164 | 162 | |
| 165 | 163 | { |
| 166 | - .label = "Icons & text", | |
| 164 | + .label = N_( "Icons & text" ), | |
| 167 | 165 | .style = GTK_TOOLBAR_BOTH |
| 168 | 166 | }, |
| 169 | 167 | }; |
| 170 | 168 | |
| 171 | 169 | size_t ix; |
| 172 | 170 | |
| 173 | - GtkWidget * item = gtk_menu_item_new_with_mnemonic("S_tyle"); | |
| 171 | + GtkWidget * item = gtk_menu_item_new_with_mnemonic( _("S_tyle") ); | |
| 174 | 172 | gtk_menu_shell_append(GTK_MENU_SHELL(widget->popup_menu),item); |
| 175 | 173 | |
| 176 | 174 | GtkWidget * submenu = gtk_menu_new(); |
| ... | ... | @@ -178,7 +176,7 @@ |
| 178 | 176 | |
| 179 | 177 | for(ix = 0; ix < G_N_ELEMENTS(itens); ix++) { |
| 180 | 178 | |
| 181 | - item = gtk_menu_item_new_with_mnemonic(itens[ix].label); | |
| 179 | + item = gtk_menu_item_new_with_mnemonic(gettext(itens[ix].label)); | |
| 182 | 180 | |
| 183 | 181 | if(ix > 0) |
| 184 | 182 | g_object_set_data(G_OBJECT(item),"toolbar_style", (gpointer) &itens[ix].style); |
| ... | ... | @@ -215,29 +213,29 @@ |
| 215 | 213 | g_return_val_if_fail(GTK_IS_TOOLBAR(toolbar),NULL); |
| 216 | 214 | |
| 217 | 215 | if(!action) { |
| 218 | - g_message("Invalid action identifier"); | |
| 216 | + g_message(_("Invalid action identifier")); | |
| 219 | 217 | return NULL; |
| 220 | 218 | } |
| 221 | 219 | |
| 222 | 220 | if(!action->icon) { |
| 223 | - g_message("Action \"%s\" doesn't have an icon", action->name); | |
| 221 | + g_message(_("Action \"%s\" doesn't have an icon"), action->name); | |
| 224 | 222 | return NULL; |
| 225 | 223 | } |
| 226 | 224 | |
| 227 | 225 | if(!action->label) { |
| 228 | - g_message("Action \"%s\" doesn't have a label", action->name); | |
| 226 | + g_message(_("Action \"%s\" doesn't have a label"), action->name); | |
| 229 | 227 | return NULL; |
| 230 | 228 | } |
| 231 | 229 | |
| 232 | 230 | debug("Action: %s icon: %s", action->name, action->icon); |
| 233 | 231 | |
| 234 | - GtkToolItem * item = gtk_tool_button_new(gtk_image_new_from_icon_name(action->icon,GTK_ICON_SIZE_LARGE_TOOLBAR),action->label); | |
| 232 | + GtkToolItem * item = gtk_tool_button_new(gtk_image_new_from_icon_name(action->icon,GTK_ICON_SIZE_LARGE_TOOLBAR),gettext(action->label)); | |
| 235 | 233 | gtk_tool_button_set_use_underline(GTK_TOOL_BUTTON(item),TRUE); |
| 236 | 234 | |
| 237 | 235 | gtk_widget_set_name(GTK_WIDGET(item), action->name); |
| 238 | 236 | |
| 239 | 237 | if(action->summary) |
| 240 | - gtk_tool_item_set_tooltip_text(item,action->summary); | |
| 238 | + gtk_tool_item_set_tooltip_text(item,gettext(action->summary)); | |
| 241 | 239 | |
| 242 | 240 | gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, pos); |
| 243 | 241 | ... | ... |
| ... | ... | @@ -0,0 +1,47 @@ |
| 1 | +/* | |
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
| 5 | + * | |
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 7 | + * | |
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 10 | + * Free Software Foundation. | |
| 11 | + * | |
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 15 | + * obter mais detalhes. | |
| 16 | + * | |
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 | + * | |
| 21 | + * Este programa está nomeado como - e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Contatos: | |
| 24 | + * | |
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 27 | + * | |
| 28 | + */ | |
| 29 | + | |
| 30 | +#ifndef PRIVATE_H_INCLUDED | |
| 31 | + | |
| 32 | + #define PRIVATE_H_INCLUDED | |
| 33 | + | |
| 34 | + #include <config.h> | |
| 35 | + | |
| 36 | + #ifndef GETTEXT_PACKAGE | |
| 37 | + #define GETTEXT_PACKAGE PACKAGE_NAME | |
| 38 | + #endif | |
| 39 | + | |
| 40 | + #include <libintl.h> | |
| 41 | + #include <glib/gi18n.h> | |
| 42 | + #include <gtk/gtk.h> | |
| 43 | + | |
| 44 | + #include <pw3270/toolbar.h> | |
| 45 | + #include <lib3270/log.h> | |
| 46 | + | |
| 47 | +#endif // PRIVATE_H_INCLUDED | ... | ... |
src/widgets/toolbar/toolbar.cbp