From 4c77d5e0aec3c7aab32965ca4e02abb17bb6108f Mon Sep 17 00:00:00 2001 From: Guilhem Bonnefille Date: Thu, 13 Dec 2007 21:17:45 +0000 Subject: [PATCH] Marking translatable strings. Remind: - _("..."): in dynamic context - N_("..."): in static context, corresponding dynamic context must be tagged with _(var) (where var contains the static string) More details at http://developer.gimp.org/api/2.0/glib/glib-I18N.html and in gettext manual http://www.gnu.org/software/gettext/manual/gettext.html --- ChangeLog | 4 + po/POTFILES.in | 32 ++++++++ src/acquire.c | 19 +++-- src/background.c | 10 ++- src/clipboard.c | 14 +++- src/curl_download.c | 3 +- src/datasource_bfilter.c | 21 +++--- src/datasource_gc.c | 11 +-- src/datasource_google.c | 10 ++- src/datasource_gps.c | 22 +++--- src/dem.c | 12 +-- src/dialog.c | 12 ++- src/download.c | 3 +- src/expedia.c | 15 ++-- src/google.c | 22 +++--- src/googlemaps.c | 6 +- src/googlesearch.c | 16 ++-- src/osm-traces.c | 50 ++++++------ src/print.c | 20 +++-- src/util.c | 7 +- src/vikcoordlayer.c | 10 ++- src/vikdemlayer.c | 24 +++--- src/vikfileentry.c | 9 ++- src/vikfilelist.c | 13 +++- src/vikgeoreflayer.c | 43 ++++++----- src/vikgpslayer.c | 59 ++++++++------- src/viklayer.c | 10 ++- src/viklayerspanel.c | 26 ++++--- src/vikmapslayer.c | 54 +++++++------ src/viktreeview.c | 10 ++- src/viktrwlayer.c | 155 +++++++++++++++++++------------------- src/viktrwlayer_propwin.c | 34 +++++---- src/viktrwlayer_tpwin.c | 24 ++++-- src/vikwindow.c | 98 +++++++++++++----------- 34 files changed, 527 insertions(+), 351 deletions(-) diff --git a/ChangeLog b/ChangeLog index d283df31..867dd6a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-12-12: +Guilhem Bonnefille : + * Marking translatable strings + 2007-12-12: Guilhem Bonnefille : * Fix warning: underquoted definition of AM_WITH_EXPAT diff --git a/po/POTFILES.in b/po/POTFILES.in index e69de29b..c8bcbfa7 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -0,0 +1,32 @@ +src/acquire.c +src/background.c +src/clipboard.c +src/curl_download.c +src/dialog.c +src/expedia.c +src/google.c +src/googlemaps.c +src/googlesearch.c +src/vikwindow.c +src/datasource_gc.c +src/datasource_google.c +src/datasource_gps.c +src/dem.c +src/download.c +src/osm-traces.c +src/print.c +src/util.c +src/vikcoordlayer.c +src/datasource_bfilter.c +src/vikdemlayer.c +src/vikfileentry.c +src/vikfilelist.c +src/vikgeoreflayer.c +src/vikgpslayer.c +src/viklayer.c +src/viklayerspanel.c +src/vikmapslayer.c +src/viktreeview.c +src/viktrwlayer.c +src/viktrwlayer_propwin.c +src/viktrwlayer_tpwin.c diff --git a/src/acquire.c b/src/acquire.c index 0968d7f8..1dc77c77 100644 --- a/src/acquire.c +++ b/src/acquire.c @@ -18,8 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include +#include #include "viking.h" #include "babel.h" @@ -108,8 +113,8 @@ static void get_from_anything ( w_and_interface_t *wi ) } if ( creating_new_layer ) { vtl = VIK_TRW_LAYER ( vik_layer_create ( VIK_LAYER_TRW, w->vvp, NULL, FALSE ) ); - vik_layer_rename ( VIK_LAYER ( vtl ), interface->layer_title ); - gtk_label_set_text ( GTK_LABEL(w->status), "Working..." ); + vik_layer_rename ( VIK_LAYER ( vtl ), _(interface->layer_title) ); + gtk_label_set_text ( GTK_LABEL(w->status), _("Working...") ); } gdk_threads_leave(); @@ -123,7 +128,7 @@ static void get_from_anything ( w_and_interface_t *wi ) if (!result) { gdk_threads_enter(); - gtk_label_set_text ( GTK_LABEL(w->status), "Error: couldn't find gpsbabel." ); + gtk_label_set_text ( GTK_LABEL(w->status), _("Error: couldn't find gpsbabel.") ); if ( creating_new_layer ) g_object_unref ( G_OBJECT ( vtl ) ); gdk_threads_leave(); @@ -131,7 +136,7 @@ static void get_from_anything ( w_and_interface_t *wi ) else { gdk_threads_enter(); if (w->ok) { - gtk_label_set_text ( GTK_LABEL(w->status), "Done." ); + gtk_label_set_text ( GTK_LABEL(w->status), _("Done.") ); if ( creating_new_layer ) vik_aggregate_layer_add_layer( vik_layers_panel_get_top_layer(w->vlp), VIK_LAYER(vtl)); if ( interface->keep_dialog_open ) { @@ -230,7 +235,7 @@ static void acquire ( VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp, VikD dialog = gtk_dialog_new_with_buttons ( "", GTK_WINDOW(vw), 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL ); interface->add_setup_widgets_func(dialog, vvp, user_data); - gtk_window_set_title ( GTK_WINDOW(dialog), interface->window_title ); + gtk_window_set_title ( GTK_WINDOW(dialog), _(interface->window_title) ); if ( gtk_dialog_run ( GTK_DIALOG(dialog) ) != GTK_RESPONSE_ACCEPT ) { interface->cleanup_func(user_data); @@ -301,12 +306,12 @@ static void acquire ( VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp, VikD dialog = gtk_dialog_new_with_buttons ( "", GTK_WINDOW(vw), 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL ); gtk_dialog_set_response_sensitive ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT, FALSE ); - gtk_window_set_title ( GTK_WINDOW(dialog), interface->window_title ); + gtk_window_set_title ( GTK_WINDOW(dialog), _(interface->window_title) ); w->dialog = dialog; w->ok = TRUE; - status = gtk_label_new ("Status: detecting gpsbabel"); + status = gtk_label_new (_("Status: detecting gpsbabel")); gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(dialog)->vbox), status, FALSE, FALSE, 5 ); gtk_widget_show_all(status); w->status = status; diff --git a/src/background.c b/src/background.c index 38b0eca0..7756af02 100644 --- a/src/background.c +++ b/src/background.c @@ -20,6 +20,8 @@ */ #include +#include + #include "vikstatus.h" #include "background.h" #include "gtkcellrendererprogress.h" @@ -50,7 +52,7 @@ void a_background_update_status ( VikStatusbar *vs, gchar *str ) static void background_thread_update () { static gchar buf[20]; - g_snprintf(buf, sizeof(buf), "%d items", bgitemcount); + g_snprintf(buf, sizeof(buf), _("%d items"), bgitemcount); g_slist_foreach ( statusbars_to_update, (GFunc) a_background_update_status, buf ); } @@ -195,11 +197,11 @@ void a_background_init() /* add columns */ renderer = gtk_cell_renderer_text_new (); - column = gtk_tree_view_column_new_with_attributes ( "Job", renderer, "text", TITLE_COLUMN, NULL ); + column = gtk_tree_view_column_new_with_attributes ( _("Job"), renderer, "text", TITLE_COLUMN, NULL ); gtk_tree_view_append_column ( GTK_TREE_VIEW(bgtreeview), column ); renderer = gtk_cell_renderer_progress_new (); - column = gtk_tree_view_column_new_with_attributes ( "Progress", renderer, "percentage", PROGRESS_COLUMN, NULL ); + column = gtk_tree_view_column_new_with_attributes ( _("Progress"), renderer, "percentage", PROGRESS_COLUMN, NULL ); gtk_tree_view_append_column ( GTK_TREE_VIEW(bgtreeview), column ); /* setup window */ @@ -210,7 +212,7 @@ void a_background_init() bgwindow = gtk_dialog_new_with_buttons ( "", NULL, 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_DELETE, 1, GTK_STOCK_CLEAR, 2, NULL ); gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(bgwindow)->vbox), scrolled_window, TRUE, TRUE, 0 ); gtk_window_set_default_size ( GTK_WINDOW(bgwindow), 400, 400 ); - gtk_window_set_title ( GTK_WINDOW(bgwindow), "Viking Background Jobs" ); + gtk_window_set_title ( GTK_WINDOW(bgwindow), _("Viking Background Jobs") ); /* don't destroy win */ g_signal_connect ( G_OBJECT(bgwindow), "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL ); diff --git a/src/clipboard.c b/src/clipboard.c index 6f747ee1..afc16f98 100644 --- a/src/clipboard.c +++ b/src/clipboard.c @@ -22,6 +22,9 @@ #include #include #include + +#include + #include "viking.h" @@ -69,7 +72,7 @@ static void clip_receive_viking ( GtkClipboard *c, GtkSelectionData *sd, gpointe VikLayersPanel *vlp = p; vik_clipboard_t *vc; if (sd->length == -1) { - g_warning ( "paste failed" ); + g_warning ( _("paste failed") ); return; } // g_print("clip receive: target = %s, type = %s\n", gdk_atom_name(sd->target), gdk_atom_name(sd->type)); @@ -79,7 +82,7 @@ static void clip_receive_viking ( GtkClipboard *c, GtkSelectionData *sd, gpointe // g_print(" sd->data = %p, sd->length = %d, vc->len = %d\n", sd->data, sd->length, vc->len); if (sd->length != sizeof(*vc) + vc->len) { - g_warning ( "wrong clipboard data size" ); + g_warning ( _("wrong clipboard data size") ); return; } @@ -97,7 +100,10 @@ static void clip_receive_viking ( GtkClipboard *c, GtkSelectionData *sd, gpointe vik_layer_get_interface(vc->layer_type)->paste_item ( sel, vc->subtype, vc->data, vc->len); } else - a_dialog_error_msg_extra ( VIK_GTK_WINDOW_FROM_WIDGET(GTK_WIDGET(vlp)), "The clipboard contains sublayer data for a %s layers. You must select a layer of this type to paste the clipboard data.", vik_layer_get_interface(vc->layer_type)->name ); + a_dialog_error_msg_extra ( VIK_GTK_WINDOW_FROM_WIDGET(GTK_WIDGET(vlp)), + _("The clipboard contains sublayer data for a %s layers." + "You must select a layer of this type to paste the clipboard data."), + vik_layer_get_interface(vc->layer_type)->name ); } } @@ -201,7 +207,7 @@ static void clip_add_wp(VikLayersPanel *vlp, struct LatLon *coord) if (sel && sel->type == VIK_LAYER_TRW) { vik_trw_layer_new_waypoint ( VIK_TRW_LAYER(sel), VIK_GTK_WINDOW_FROM_LAYER(sel), &vc ); } else { - a_dialog_error_msg_extra ( VIK_GTK_WINDOW_FROM_WIDGET(GTK_WIDGET(vlp)), "In order to paste a waypoint, please select an appropriate layer to paste into.", NULL); + a_dialog_error_msg_extra ( VIK_GTK_WINDOW_FROM_WIDGET(GTK_WIDGET(vlp)), _("In order to paste a waypoint, please select an appropriate layer to paste into."), NULL); } } diff --git a/src/curl_download.c b/src/curl_download.c index c53fd82f..4e38aafd 100644 --- a/src/curl_download.c +++ b/src/curl_download.c @@ -25,6 +25,7 @@ #include "config.h" #endif +#include #include #include @@ -58,7 +59,7 @@ static gchar *get_cookie_file(gboolean init) curl_easy_setopt(curl, CURLOPT_COOKIEJAR, cookie_file); res = curl_easy_perform(curl); if (res != CURLE_OK) { - g_warning("%s() Curl perform failed: %s\n", __PRETTY_FUNCTION__, + g_warning(_("%s() Curl perform failed: %s"), __PRETTY_FUNCTION__, curl_easy_strerror(res)); unlink(cookie_file); } diff --git a/src/datasource_bfilter.c b/src/datasource_bfilter.c index 2fb1e6c4..cfa3296b 100644 --- a/src/datasource_bfilter.c +++ b/src/datasource_bfilter.c @@ -18,8 +18,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include +#include #include "viking.h" #include "babel.h" @@ -40,7 +43,7 @@ VikLayerParamScale simplify_params_scales[] = { }; VikLayerParam bfilter_simplify_params[] = { - { "numberofpoints", VIK_LAYER_PARAM_UINT, VIK_LAYER_GROUP_NONE, "Max number of points:", VIK_LAYER_WIDGET_SPINBUTTON, simplify_params_scales + 0 }, + { "numberofpoints", VIK_LAYER_PARAM_UINT, VIK_LAYER_GROUP_NONE, N_("Max number of points:"), VIK_LAYER_WIDGET_SPINBUTTON, simplify_params_scales + 0 }, }; VikLayerParamData bfilter_simplify_params_defaults[] = { @@ -48,8 +51,8 @@ VikLayerParamData bfilter_simplify_params_defaults[] = { }; VikDataSourceInterface vik_datasource_bfilter_simplify_interface = { - "Simplify All Tracks", - "Simplified Tracks", + N_("Simplify All Tracks"), + N_("Simplified Tracks"), VIK_DATASOURCE_SHELL_CMD, VIK_DATASOURCE_CREATENEWLAYER, VIK_DATASOURCE_INPUTTYPE_TRWLAYER, @@ -81,8 +84,8 @@ static void datasource_bfilter_dup_get_cmd_string ( VikLayerParamData *paramdata VikDataSourceInterface vik_datasource_bfilter_dup_interface = { - "Remove Duplicate Waypoints", - "Remove Duplicate Waypoints", + N_("Remove Duplicate Waypoints"), + N_("Remove Duplicate Waypoints"), VIK_DATASOURCE_SHELL_CMD, VIK_DATASOURCE_CREATENEWLAYER, VIK_DATASOURCE_INPUTTYPE_TRWLAYER, @@ -111,8 +114,8 @@ static void datasource_bfilter_polygon_get_cmd_string ( VikLayerParamData *param VikDataSourceInterface vik_datasource_bfilter_polygon_interface = { - "Waypoints Inside This", - "Polygonzied Layer", + N_("Waypoints Inside This"), + N_("Polygonzied Layer"), VIK_DATASOURCE_SHELL_CMD, VIK_DATASOURCE_CREATENEWLAYER, VIK_DATASOURCE_INPUTTYPE_TRWLAYER_TRACK, @@ -144,8 +147,8 @@ static void datasource_bfilter_exclude_polygon_get_cmd_string ( VikLayerParamDat VikDataSourceInterface vik_datasource_bfilter_exclude_polygon_interface = { - "Waypoints Outside This", - "Polygonzied Layer", + N_("Waypoints Outside This"), + N_("Polygonzied Layer"), VIK_DATASOURCE_SHELL_CMD, VIK_DATASOURCE_CREATENEWLAYER, VIK_DATASOURCE_INPUTTYPE_TRWLAYER_TRACK, diff --git a/src/datasource_gc.c b/src/datasource_gc.c index 551e19f5..96b1394f 100644 --- a/src/datasource_gc.c +++ b/src/datasource_gc.c @@ -22,6 +22,7 @@ #ifdef VIK_CONFIG_GEOCACHES #include +#include #include "viking.h" #include "babel.h" @@ -49,8 +50,8 @@ static gchar *datasource_gc_check_existence (); #define METERSPERMILE 1609.344 VikDataSourceInterface vik_datasource_gc_interface = { - "Download Geocaches", - "Geocaching.com Caches", + N_("Download Geocaches"), + N_("Geocaching.com Caches"), VIK_DATASOURCE_SHELL_CMD, VIK_DATASOURCE_ADDTOLAYER, VIK_DATASOURCE_INPUTTYPE_NONE, @@ -77,7 +78,7 @@ static gchar *datasource_gc_check_existence () g_free(gcget_location); return NULL; } - return g_strdup("Can't find gcget in path! Check that you have installed gcget correctly."); + return g_strdup(_("Can't find gcget in path! Check that you have installed gcget correctly.")); } static void datasource_gc_draw_circle ( datasource_gc_widgets_t *widgets ) @@ -139,9 +140,9 @@ static void datasource_gc_add_setup_widgets ( GtkWidget *dialog, VikViewport *vv struct LatLon ll; gchar *s_ll; - num_label = gtk_label_new ("Max number geocaches:"); + num_label = gtk_label_new (_("Number geocaches:")); widgets->num_spin = gtk_spin_button_new ( GTK_ADJUSTMENT(gtk_adjustment_new( 100, 1, 1000, 10, 20, 50 )), 25, 0 ); - center_label = gtk_label_new ("Centered around:"); + center_label = gtk_label_new (_("Centered around:")); widgets->center_entry = gtk_entry_new(); miles_radius_label = gtk_label_new ("Miles Radius:"); widgets->miles_radius_spin = gtk_spin_button_new ( GTK_ADJUSTMENT(gtk_adjustment_new( 100, 1, 1000, 5, 20, 50 )), 25, 2 ); diff --git a/src/datasource_google.c b/src/datasource_google.c index e32f74f1..04be2307 100644 --- a/src/datasource_google.c +++ b/src/datasource_google.c @@ -19,7 +19,9 @@ * */ #include + #include +#include #include "viking.h" #include "babel.h" @@ -41,8 +43,8 @@ static void datasource_google_get_cmd_string ( datasource_google_widgets_t *widg static void datasource_google_cleanup ( gpointer data ); VikDataSourceInterface vik_datasource_google_interface = { - "Google Directions", - "Google Directions", + N_("Google Directions"), + N_("Google Directions"), VIK_DATASOURCE_SHELL_CMD, VIK_DATASOURCE_ADDTOLAYER, VIK_DATASOURCE_INPUTTYPE_NONE, @@ -66,9 +68,9 @@ static void datasource_google_add_setup_widgets ( GtkWidget *dialog, VikViewport { datasource_google_widgets_t *widgets = (datasource_google_widgets_t *)user_data; GtkWidget *from_label, *to_label; - from_label = gtk_label_new ("From:"); + from_label = gtk_label_new (_("From:")); widgets->from_entry = gtk_entry_new(); - to_label = gtk_label_new ("To:"); + to_label = gtk_label_new (_("To:")); widgets->to_entry = gtk_entry_new(); if (last_from_str) gtk_entry_set_text(GTK_ENTRY(widgets->from_entry), last_from_str); diff --git a/src/datasource_gps.c b/src/datasource_gps.c index 9b6d984c..81fef86a 100644 --- a/src/datasource_gps.c +++ b/src/datasource_gps.c @@ -19,7 +19,9 @@ * */ #include + #include +#include #include "viking.h" #include "babel.h" @@ -40,8 +42,8 @@ static void datasource_gps_add_setup_widgets ( GtkWidget *dialog, VikViewport *v static void datasource_gps_add_progress_widgets ( GtkWidget *dialog, gpointer user_data ); VikDataSourceInterface vik_datasource_gps_interface = { - "Acquire from GPS", - "Acquired from GPS", + N_("Acquire from GPS"), + N_("Acquired from GPS"), VIK_DATASOURCE_GPSBABEL_DIRECT, VIK_DATASOURCE_CREATENEWLAYER, VIK_DATASOURCE_INPUTTYPE_NONE, @@ -125,7 +127,7 @@ static void datasource_gps_get_cmd_string ( gpointer user_data, gchar **babelarg #endif *input_file = g_strdup(ser); - g_debug("using cmdline '%s' and file '%s'\n", *babelargs, *input_file); + g_debug(_("using cmdline '%s' and file '%s'\n"), *babelargs, *input_file); } static void datasource_gps_cleanup ( gpointer user_data ) @@ -140,7 +142,7 @@ static void set_total_count(gint cnt, acq_dialog_widgets_t *w) gdk_threads_enter(); if (w->ok) { gps_user_data_t *gps_data = (gps_user_data_t *)w->user_data; - s = g_strdup_printf("Downloading %d %s...", cnt, (gps_data->progress_label == gps_data->wp_label) ? "waypoints" : "trackpoints"); + s = g_strdup_printf(_("Downloading %d %s..."), cnt, (gps_data->progress_label == gps_data->wp_label) ? "waypoints" : "trackpoints"); gtk_label_set_text ( GTK_LABEL(gps_data->progress_label), s ); gtk_widget_show ( gps_data->progress_label ); gps_data->total_count = cnt; @@ -157,9 +159,9 @@ static void set_current_count(gint cnt, acq_dialog_widgets_t *w) gps_user_data_t *gps_data = (gps_user_data_t *)w->user_data; if (cnt < gps_data->total_count) { - s = g_strdup_printf("Downloaded %d out of %d %s...", cnt, gps_data->total_count, (gps_data->progress_label == gps_data->wp_label) ? "waypoints" : "trackpoints"); + s = g_strdup_printf(_("Downloaded %d out of %d %s..."), cnt, gps_data->total_count, (gps_data->progress_label == gps_data->wp_label) ? "waypoints" : "trackpoints"); } else { - s = g_strdup_printf("Downloaded %d %s.", cnt, (gps_data->progress_label == gps_data->wp_label) ? "waypoints" : "trackpoints"); + s = g_strdup_printf(_("Downloaded %d %s."), cnt, (gps_data->progress_label == gps_data->wp_label) ? "waypoints" : "trackpoints"); } gtk_label_set_text ( GTK_LABEL(gps_data->progress_label), s ); } @@ -172,7 +174,7 @@ static void set_gps_info(const gchar *info, acq_dialog_widgets_t *w) gchar *s = NULL; gdk_threads_enter(); if (w->ok) { - s = g_strdup_printf("GPS Device: %s", info); + s = g_strdup_printf(_("GPS Device: %s"), info); gtk_label_set_text ( GTK_LABEL(((gps_user_data_t *)w->user_data)->gps_label), s ); } g_free(s); s = NULL; @@ -249,14 +251,14 @@ void datasource_gps_add_setup_widgets ( GtkWidget *dialog, VikViewport *vvp, gpo gps_user_data_t *w = (gps_user_data_t *)user_data; GtkTable* box; - w->proto_l = gtk_label_new ("GPS Protocol:"); + w->proto_l = gtk_label_new (_("GPS Protocol:")); w->proto_b = GTK_COMBO_BOX(gtk_combo_box_new_text ()); gtk_combo_box_append_text (w->proto_b, "Garmin"); gtk_combo_box_append_text (w->proto_b, "Magellan"); gtk_combo_box_set_active (w->proto_b, 0); g_object_ref(w->proto_b); - w->ser_l = gtk_label_new ("Serial Port:"); + w->ser_l = gtk_label_new (_("Serial Port:")); w->ser_b = GTK_COMBO_BOX(gtk_combo_box_entry_new_text ()); gtk_combo_box_append_text (w->ser_b, "/dev/ttyS0"); gtk_combo_box_append_text (w->ser_b, "/dev/ttyS1"); @@ -282,7 +284,7 @@ void datasource_gps_add_progress_widgets ( GtkWidget *dialog, gpointer user_data gps_user_data_t *w_gps = (gps_user_data_t *)user_data; - gpslabel = gtk_label_new ("GPS device: N/A"); + gpslabel = gtk_label_new (_("GPS device: N/A")); verlabel = gtk_label_new (""); idlabel = gtk_label_new (""); wplabel = gtk_label_new (""); diff --git a/src/dem.c b/src/dem.c index d9d1206c..e8a7698f 100644 --- a/src/dem.c +++ b/src/dem.c @@ -10,6 +10,8 @@ #include +#include + #include "dem.h" #include "file.h" @@ -22,7 +24,7 @@ static gboolean get_double_and_continue ( gchar **buffer, gdouble *tmp, gboolean *tmp = g_strtod(*buffer, &endptr); if ( endptr == NULL|| endptr == *buffer ) { if ( warn ) - g_warning("Invalid DEM"); + g_warning(_("Invalid DEM")); return FALSE; } *buffer=endptr; @@ -36,7 +38,7 @@ static gboolean get_int_and_continue ( gchar **buffer, gint *tmp, gboolean warn *tmp = strtol(*buffer, &endptr, 10); if ( endptr == NULL|| endptr == *buffer ) { if ( warn ) - g_warning("Invalid DEM"); + g_warning(_("Invalid DEM")); return FALSE; } *buffer=endptr; @@ -78,7 +80,7 @@ static gboolean dem_parse_header ( gchar *buffer, VikDEM *dem ) /* skip numbers 5-19 */ for ( i = 0; i < 15; i++ ) { if ( ! get_double_and_continue(&buffer, &val, FALSE) ) { - g_warning ("Invalid DEM header"); + g_warning (_("Invalid DEM header")); return FALSE; } } @@ -147,7 +149,7 @@ static void dem_parse_block_as_header ( gchar *buffer, VikDEM *dem, gint *cur_co /* 1 x n_rows 1 east_west south x x x DATA */ if ( (!get_double_and_continue(&buffer, &tmp, TRUE)) || tmp != 1 ) { - g_warning("Incorrect DEM Class B record: expected 1"); + g_warning(_("Incorrect DEM Class B record: expected 1")); return; } @@ -160,7 +162,7 @@ static void dem_parse_block_as_header ( gchar *buffer, VikDEM *dem, gint *cur_co n_rows = (guint) tmp; if ( (!get_double_and_continue(&buffer, &tmp, TRUE)) || tmp != 1 ) { - g_warning("Incorrect DEM Class B record: expected 1"); + g_warning(_("Incorrect DEM Class B record: expected 1")); return; } diff --git a/src/dialog.c b/src/dialog.c index bcb07310..c8e72264 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "viking.h" #include "thumbnails.h" #include "garminsymbols.h" @@ -26,6 +30,8 @@ #include "authors.h" #include "googlesearch.h" +#include + #include #include #include @@ -420,7 +426,7 @@ GtkWidget *a_dialog_create_label_vbox ( gchar **texts, int label_count ) for ( i = 0; i < label_count; i++ ) { label = gtk_label_new(NULL); - gtk_label_set_markup ( GTK_LABEL(label), texts[i] ); + gtk_label_set_markup ( GTK_LABEL(label), _(texts[i]) ); gtk_box_pack_start ( GTK_BOX(vbox), label, FALSE, TRUE, 5 ); } return vbox; @@ -574,10 +580,10 @@ void a_dialog_about ( GtkWindow *parent ) { int re; char *msg = g_markup_printf_escaped ( - "Viking %s\n\n" + _("Viking %s\n\n" "GPS Data and Topo Analyzer, Explorer, and Manager.\n\n" "(C) 2003-2007, Evan Battaglia\n\n" - "Web site: %s", + "Web site: %s"), VIKING_VERSION, VIKING_URL); GtkWidget *msgbox = gtk_message_dialog_new_with_markup ( parent, GTK_DIALOG_DESTROY_WITH_PARENT, diff --git a/src/download.c b/src/download.c index 23f28c9a..0716ecf9 100644 --- a/src/download.c +++ b/src/download.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "download.h" @@ -141,7 +142,7 @@ static int download( const char *hostname, const char *uri, const char *fn, Down if (ret == -1 || ret == 1 || ret == -2 || check_map_file(f)) { - g_warning("Download error: %s\n", fn); + g_warning(_("Download error: %s\n"), fn); fclose ( f ); remove ( tmpfilename ); g_free ( tmpfilename ); diff --git a/src/expedia.c b/src/expedia.c index d7de9ee7..e7a41699 100644 --- a/src/expedia.c +++ b/src/expedia.c @@ -21,7 +21,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include #include #include #include "globals.h" @@ -41,7 +45,7 @@ static DownloadOptions expedia_options = { NULL, 2 }; void expedia_init() { VikMapsLayer_MapType map_type = { 5, 0, 0, VIK_VIEWPORT_DRAWMODE_EXPEDIA, expedia_coord_to_mapcoord, expedia_mapcoord_to_center_coord, expedia_download }; - maps_layer_register_type("Expedia Street Maps", 5, &map_type); + maps_layer_register_type(_("Expedia Street Maps"), 5, &map_type); } #define EXPEDIA_SITE "expedia.com" @@ -69,7 +73,7 @@ gdouble expedia_altis_freq ( gint alti ) if ( expedia_altis[i] == alti ) return expedia_altis_degree_freq [ i ]; - g_error ( "Invalid expedia altitude" ); + g_error ( _("Invalid expedia altitude") ); return 0; } @@ -100,7 +104,7 @@ void expedia_snip ( const gchar *file ) old = gdk_pixbuf_new_from_file ( file, &gx ); if (gx) { - g_warning ( "Couldn't open EXPEDIA image file (right after successful download! Please report and delete image file!): %s", gx->message ); + g_warning ( _("Couldn't open EXPEDIA image file (right after successful download! Please report and delete image file!): %s"), gx->message ); g_error_free ( gx ); return; } @@ -113,7 +117,7 @@ void expedia_snip ( const gchar *file ) gdk_pixbuf_save ( cropped, file, "png", &gx, NULL ); if ( gx ) { - g_warning ( "Couldn't save EXPEDIA image file (right after successful download! Please report and delete image file!): %s", gx->message ); + g_warning ( _("Couldn't save EXPEDIA image file (right after successful download! Please report and delete image file!): %s"), gx->message ); g_error_free ( gx ); } @@ -178,9 +182,8 @@ static int expedia_download ( MapCoord *src, const gchar *dest_fn ) uri = g_strdup_printf ( "/pub/agent.dll?qscr=mrdt&ID=3XNsF.&CenP=%lf,%lf&Lang=%s&Alti=%d&Size=%d,%d&Offs=0.000000,0.000000&BCheck&tpid=1", ll.lat, ll.lon, (ll.lon > -30) ? "EUR0809" : "USA0409", src->scale, width, height ); - if ((res = a_http_download_get_url ( "expedia.com", uri, dest_fn, &expedia_options )) == 0) /* All OK */ + if ((res = a_http_download_get_url ( EXPEDIA_SITE, uri, dest_fn, &expedia_options )) == 0) /* All OK */ expedia_snip ( dest_fn ); return(res); } - diff --git a/src/google.c b/src/google.c index eac49bc4..e938520e 100644 --- a/src/google.c +++ b/src/google.c @@ -18,9 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include +#include #include #include #include @@ -49,10 +53,10 @@ void google_init () { VikMapsLayer_MapType google_3 = { 11, 256, 256, VIK_VIEWPORT_DRAWMODE_MERCATOR, google_coord_to_mapcoord, google_mapcoord_to_center_coord, google_kh_download }; VikMapsLayer_MapType google_4 = { 16, 256, 256, VIK_VIEWPORT_DRAWMODE_MERCATOR, google_coord_to_mapcoord, google_mapcoord_to_center_coord, google_terrain_download }; - maps_layer_register_type("Google Maps", 7, &google_1); - maps_layer_register_type("Transparent Google Maps", 10, &google_2); - maps_layer_register_type("Google Satellite Images", 11, &google_3); - maps_layer_register_type("Google Terrain Maps", 16, &google_4); + maps_layer_register_type(_("Google Maps"), 7, &google_1); + maps_layer_register_type(_("Transparent Google Maps"), 10, &google_2); + maps_layer_register_type(_("Google Satellite Images"), 11, &google_3); + maps_layer_register_type(_("Google Terrain Maps"), 16, &google_4); } /* 1 << (x) is like a 2**(x) */ @@ -123,7 +127,7 @@ static const gchar *google_version_number(MapCoord *mapcoord, GoogleType google_ first = FALSE; gvers = tvers = kvers = terrvers = NULL; if ((tmp_fd = g_file_open_tmp ("vikgvers.XXXXXX", &tmpname, NULL)) == -1) { - g_critical("couldn't open temp file %s\n", tmpname); + g_critical(_("couldn't open temp file %s\n"), tmpname); exit(1); } @@ -132,17 +136,17 @@ static const gchar *google_version_number(MapCoord *mapcoord, GoogleType google_ tmp_file = fdopen(tmp_fd, "r+"); if (curl_download_uri(uri, tmp_file, &dl_options)) { /* error */ - g_warning("Failed downloading %s\n", tmpname); + g_warning(_("Failed downloading %s\n"), tmpname); } else { if ((mf = g_mapped_file_new(tmpname, FALSE, NULL)) == NULL) { - g_critical("couldn't map temp file\n"); + g_critical(_("couldn't map temp file\n")); exit(1); } len = g_mapped_file_get_length(mf); text = g_mapped_file_get_contents(mf); if ((beg = g_strstr_len(text, len, "GLoadApi")) == NULL) { - g_warning("Failed fetching Google numbers (\"GLoadApi\" not found)\n"); + g_warning(_("Failed fetching Google numbers (\"GLoadApi\" not found)\n")); goto failed; } @@ -173,7 +177,7 @@ static const gchar *google_version_number(MapCoord *mapcoord, GoogleType google_ vers[TYPE_GOOGLE_TERRAIN] = terrvers; } else - g_warning("Failed getting google version numbers"); + g_warning(_("Failed getting google version numbers")); if (gvers) fprintf(stderr, "DEBUG gvers=%s\n", gvers); diff --git a/src/googlemaps.c b/src/googlemaps.c index b0761f2a..f7cb707f 100644 --- a/src/googlemaps.c +++ b/src/googlemaps.c @@ -18,7 +18,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include #include #include #include "viking.h" @@ -35,7 +39,7 @@ static DownloadOptions googlemaps_options = { "http://maps.google.com/", 0 }; /* initialisation */ void googlemaps_init () { VikMapsLayer_MapType map_type = { 9, 128, 128, VIK_VIEWPORT_DRAWMODE_GOOGLE, googlemaps_coord_to_mapcoord, googlemaps_mapcoord_to_center_coord, googlemaps_download }; - maps_layer_register_type("Old Google Maps", 9, &map_type); + maps_layer_register_type(_("Old Google Maps"), 9, &map_type); } /* 1 << (x-1) is like a 2**(x-1) */ diff --git a/src/googlesearch.c b/src/googlesearch.c index 5a6fccb2..3448200f 100644 --- a/src/googlesearch.c +++ b/src/googlesearch.c @@ -19,9 +19,13 @@ * * Created by Quy Tonthat */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include #include +#include #include "viking.h" #include "curl_download.h" @@ -57,9 +61,9 @@ static gboolean prompt_try_again(VikWindow *vw) gboolean ret = TRUE; dialog = gtk_dialog_new_with_buttons ( "", GTK_WINDOW(vw), 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL ); - gtk_window_set_title(GTK_WINDOW(dialog), "Search"); + gtk_window_set_title(GTK_WINDOW(dialog), _("Search")); - GtkWidget *search_label = gtk_label_new("I don't know that place. Do you want another search?"); + GtkWidget *search_label = gtk_label_new(_("I don't know that place. Do you want another search?")); gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(dialog)->vbox), search_label, FALSE, FALSE, 5 ); gtk_widget_show_all(dialog); @@ -75,9 +79,9 @@ static gchar * a_prompt_for_search_string(VikWindow *vw) GtkWidget *dialog = NULL; dialog = gtk_dialog_new_with_buttons ( "", GTK_WINDOW(vw), 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL ); - gtk_window_set_title(GTK_WINDOW(dialog), "Search"); + gtk_window_set_title(GTK_WINDOW(dialog), _("Search")); - GtkWidget *search_label = gtk_label_new("Enter address or place name:"); + GtkWidget *search_label = gtk_label_new(_("Enter address or place name:")); GtkWidget *search_entry = gtk_entry_new(); if (last_search_str) gtk_entry_set_text(GTK_ENTRY(search_entry), last_search_str); @@ -116,7 +120,7 @@ static gboolean parse_file_for_latlon(gchar *file_name, struct LatLon *ll) lat_buf[0] = lon_buf[0] = '\0'; if ((mf = g_mapped_file_new(file_name, FALSE, NULL)) == NULL) { - g_critical("couldn't map temp file\n"); + g_critical(_("couldn't map temp file\n")); exit(1); } len = g_mapped_file_get_length(mf); @@ -205,7 +209,7 @@ static int google_search_get_coord(VikWindow *vw, VikViewport *vvp, gchar *srch_ escaped_srch_str = uri_escape(srch_str); if ((tmp_fd = g_file_open_tmp ("vikgsearch.XXXXXX", &tmpname, NULL)) == -1) { - g_critical("couldn't open temp file\n"); + g_critical(_("couldn't open temp file\n")); exit(1); } diff --git a/src/osm-traces.c b/src/osm-traces.c index 48963211..017f7be4 100644 --- a/src/osm-traces.c +++ b/src/osm-traces.c @@ -18,6 +18,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include @@ -32,6 +35,7 @@ #include #include +#include #include "viking.h" #include "viktrwlayer.h" @@ -188,14 +192,14 @@ void osm_traces_upload_file(const char *user, { g_debug("received valid curl response: %ld", code); if (code != 200) - g_warning("failed to upload data: HTTP response is %ld", code); + g_warning(_("failed to upload data: HTTP response is %ld"), code); } else - g_error("curl_easy_getinfo failed: %d", res); + g_error(_("curl_easy_getinfo failed: %d"), res); } else { - g_warning("curl request failed: %s", curl_error_buffer); + g_warning(_("curl request failed: %s"), curl_error_buffer); } /* Memory */ @@ -221,7 +225,7 @@ static void osm_traces_upload_thread ( OsmTracesInfo *oti, gpointer threaddata ) /* Opening temporary file */ fd = g_file_open_tmp("viking_osm_upload_XXXXXX.gpx", &filename, &error); if (fd < 0) { - g_error("failed to open temporary file: %s", strerror(errno)); + g_error(_("failed to open temporary file: %s"), strerror(errno)); return; } g_clear_error(&error); @@ -252,7 +256,7 @@ static void osm_traces_upload_thread ( OsmTracesInfo *oti, gpointer threaddata ) /* Removing temporary file */ ret = g_unlink(filename); if (ret != 0) { - g_error("failed to unlink temporary file: %s", strerror(errno)); + g_error(_("failed to unlink temporary file: %s"), strerror(errno)); } } @@ -264,7 +268,7 @@ static void osm_traces_upload_thread ( OsmTracesInfo *oti, gpointer threaddata ) */ static void osm_traces_upload_viktrwlayer ( VikTrwLayer *vtl, const gchar *track_name ) { - GtkWidget *dia = gtk_dialog_new_with_buttons ("OSM upload", + GtkWidget *dia = gtk_dialog_new_with_buttons (_("OSM upload"), VIK_GTK_WINDOW_FROM_LAYER(vtl), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, @@ -284,7 +288,7 @@ static void osm_traces_upload_viktrwlayer ( VikTrwLayer *vtl, const gchar *track dialog_tips = gtk_tooltips_new(); - user_label = gtk_label_new("Email:"); + user_label = gtk_label_new(_("Email:")); user_entry = gtk_entry_new(); if (user != NULL) gtk_entry_set_text(GTK_ENTRY(user_entry), user); @@ -299,10 +303,10 @@ static void osm_traces_upload_viktrwlayer ( VikTrwLayer *vtl, const gchar *track gtk_widget_show_all ( user_label ); gtk_widget_show_all ( user_entry ); gtk_tooltips_set_tip (dialog_tips, user_entry, - "The email used as login", - "Enter the email you use to login into www.openstreetmap.org."); + _("The email used as login"), + _("Enter the email you use to login into www.openstreetmap.org.")); - password_label = gtk_label_new("Password:"); + password_label = gtk_label_new(_("Password:")); password_entry = gtk_entry_new(); if (password != NULL) gtk_entry_set_text(GTK_ENTRY(password_entry), password); @@ -313,10 +317,10 @@ static void osm_traces_upload_viktrwlayer ( VikTrwLayer *vtl, const gchar *track gtk_widget_show_all ( password_label ); gtk_widget_show_all ( password_entry ); gtk_tooltips_set_tip (dialog_tips, password_entry, - "The password used to login", - "Enter the password you use to login into www.openstreetmap.org."); + _("The password used to login"), + _("Enter the password you use to login into www.openstreetmap.org.")); - name_label = gtk_label_new("File's name:"); + name_label = gtk_label_new(_("File's name:")); name_entry = gtk_entry_new(); if (track_name != NULL) name = track_name; @@ -328,37 +332,37 @@ static void osm_traces_upload_viktrwlayer ( VikTrwLayer *vtl, const gchar *track gtk_widget_show_all ( name_label ); gtk_widget_show_all ( name_entry ); gtk_tooltips_set_tip (dialog_tips, name_entry, - "The name of the file on OSM", - "This is the name of the file created on the server. " - "This is not the name of the local file."); + _("The name of the file on OSM"), + _("This is the name of the file created on the server. " + "This is not the name of the local file.")); - description_label = gtk_label_new("Description:"); + description_label = gtk_label_new(_("Description:")); description_entry = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dia)->vbox), description_label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dia)->vbox), description_entry, FALSE, FALSE, 0); gtk_widget_show_all ( description_label ); gtk_widget_show_all ( description_entry ); gtk_tooltips_set_tip (dialog_tips, description_entry, - "The description of the trace", + _("The description of the trace"), ""); - tags_label = gtk_label_new("Tags:"); + tags_label = gtk_label_new(_("Tags:")); tags_entry = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dia)->vbox), tags_label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dia)->vbox), tags_entry, FALSE, FALSE, 0); gtk_widget_show_all ( tags_label ); gtk_widget_show_all ( tags_entry ); gtk_tooltips_set_tip (dialog_tips, tags_entry, - "The tags associated to the trace", + _("The tags associated to the trace"), ""); - public = gtk_check_button_new_with_label("Public"); + public = gtk_check_button_new_with_label(_("Public")); /* Set public by default */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(public), TRUE); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dia)->vbox), public, FALSE, FALSE, 0); gtk_widget_show_all ( public ); gtk_tooltips_set_tip (dialog_tips, public, - "Indicates if the trace is public or not", + _("Indicates if the trace is public or not"), ""); if ( gtk_dialog_run ( GTK_DIALOG(dia) ) == GTK_RESPONSE_ACCEPT ) @@ -379,7 +383,7 @@ static void osm_traces_upload_viktrwlayer ( VikTrwLayer *vtl, const gchar *track info->vtl = VIK_TRW_LAYER(g_object_ref(vtl)); info->track_name = (track_name == NULL) ? NULL : g_strdup(track_name); - title = g_strdup_printf("Uploading %s to OSM", info->name); + title = g_strdup_printf(_("Uploading %s to OSM"), info->name); /* launch the thread */ a_background_thread(VIK_GTK_WINDOW_FROM_LAYER(vtl), /* parent window */ diff --git a/src/print.c b/src/print.c index 5d9ec1d4..29bb613a 100644 --- a/src/print.c +++ b/src/print.c @@ -21,12 +21,16 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include - -#if GTK_CHECK_VERSION(2,10,0) +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include +#include +#include + +#if GTK_CHECK_VERSION(2,10,0) #include "viking.h" #include "print.h" @@ -46,10 +50,10 @@ typedef struct { } PrintCenterName; static const PrintCenterName center_modes[] = { - {"None", VIK_PRINT_CENTER_NONE}, - {"Horizontally", VIK_PRINT_CENTER_HORIZONTALLY}, - {"Vertically", VIK_PRINT_CENTER_VERTICALLY}, - {"Both", VIK_PRINT_CENTER_BOTH}, + {N_("None"), VIK_PRINT_CENTER_NONE}, + {N_("Horizontally"), VIK_PRINT_CENTER_HORIZONTALLY}, + {N_("Vertically"), VIK_PRINT_CENTER_VERTICALLY}, + {N_("Both"), VIK_PRINT_CENTER_BOTH}, {NULL, -1} }; @@ -595,7 +599,7 @@ static GtkWidget *create_custom_widget_cb(GtkPrintOperation *operation, PrintDat combo = gtk_combo_box_new_text (); for (center = center_modes; center->name; center++) { - gtk_combo_box_append_text(GTK_COMBO_BOX(combo), center->name); + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _(center->name)); } gtk_combo_box_set_active(GTK_COMBO_BOX(combo), VIK_PRINT_CENTER_BOTH); gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0); diff --git a/src/util.c b/src/util.c index 655fed8e..3c994ecf 100644 --- a/src/util.c +++ b/src/util.c @@ -17,6 +17,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include #include "dialog.h" @@ -53,6 +58,6 @@ void open_url(GtkWindow *parent, const gchar * url) browser = browsers[i++]; } while(browser); - a_dialog_error_msg ( parent, "Could not launch web browser." ); + a_dialog_error_msg ( parent, _("Could not launch web browser.") ); #endif /* WINDOWS */ } diff --git a/src/vikcoordlayer.c b/src/vikcoordlayer.c index c06e214b..000db82a 100644 --- a/src/vikcoordlayer.c +++ b/src/vikcoordlayer.c @@ -18,7 +18,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include +#include #include "viking.h" #include "vikcoordlayer_pixmap.h" @@ -36,9 +40,9 @@ static VikLayerParamScale param_scales[] = { }; static VikLayerParam coord_layer_params[] = { - { "color", VIK_LAYER_PARAM_STRING, VIK_LAYER_GROUP_NONE, "Color:", VIK_LAYER_WIDGET_ENTRY }, - { "min_inc", VIK_LAYER_PARAM_DOUBLE, VIK_LAYER_GROUP_NONE, "Minutes Width:", VIK_LAYER_WIDGET_SPINBUTTON, param_scales + 0 }, - { "line_thickness", VIK_LAYER_PARAM_UINT, VIK_LAYER_GROUP_NONE, "Line Thickness:", VIK_LAYER_WIDGET_SPINBUTTON, param_scales + 1 }, + { "color", VIK_LAYER_PARAM_STRING, VIK_LAYER_GROUP_NONE, N_("Color:"), VIK_LAYER_WIDGET_ENTRY }, + { "min_inc", VIK_LAYER_PARAM_DOUBLE, VIK_LAYER_GROUP_NONE, N_("Minutes Width:"), VIK_LAYER_WIDGET_SPINBUTTON, param_scales + 0 }, + { "line_thickness", VIK_LAYER_PARAM_UINT, VIK_LAYER_GROUP_NONE, N_("Line Thickness:"), VIK_LAYER_WIDGET_SPINBUTTON, param_scales + 1 }, }; diff --git a/src/vikdemlayer.c b/src/vikdemlayer.c index eab3054e..5a2b07ae 100644 --- a/src/vikdemlayer.c +++ b/src/vikdemlayer.c @@ -18,11 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include #include #include #include +#include #include "config.h" #include "globals.h" @@ -93,12 +97,12 @@ enum { DEM_SOURCE_SRTM, }; static VikLayerParam dem_layer_params[] = { - { "files", VIK_LAYER_PARAM_STRING_LIST, VIK_LAYER_GROUP_NONE, "DEM Files:", VIK_LAYER_WIDGET_FILELIST }, - { "source", VIK_LAYER_PARAM_UINT, VIK_LAYER_GROUP_NONE, "Download Source:", VIK_LAYER_WIDGET_RADIOGROUP_STATIC, params_source, NULL }, - { "color", VIK_LAYER_PARAM_STRING, VIK_LAYER_GROUP_NONE, "Color:", VIK_LAYER_WIDGET_ENTRY }, - { "min_elev", VIK_LAYER_PARAM_DOUBLE, VIK_LAYER_GROUP_NONE, "Min Elev:", VIK_LAYER_WIDGET_SPINBUTTON, param_scales + 0 }, - { "max_elev", VIK_LAYER_PARAM_DOUBLE, VIK_LAYER_GROUP_NONE, "Max Elev:", VIK_LAYER_WIDGET_SPINBUTTON, param_scales + 0 }, - { "line_thickness", VIK_LAYER_PARAM_UINT, VIK_LAYER_GROUP_NONE, "Line Thickness:", VIK_LAYER_WIDGET_SPINBUTTON, param_scales + 1 }, + { "files", VIK_LAYER_PARAM_STRING_LIST, VIK_LAYER_GROUP_NONE, N_("DEM Files:"), VIK_LAYER_WIDGET_FILELIST }, + { "source", VIK_LAYER_PARAM_UINT, VIK_LAYER_GROUP_NONE, N_("Download Source:"), VIK_LAYER_WIDGET_RADIOGROUP_STATIC, params_source, NULL }, + { "color", VIK_LAYER_PARAM_STRING, VIK_LAYER_GROUP_NONE, N_("Color:"), VIK_LAYER_WIDGET_ENTRY }, + { "min_elev", VIK_LAYER_PARAM_DOUBLE, VIK_LAYER_GROUP_NONE, N_("Min Elev:"), VIK_LAYER_WIDGET_SPINBUTTON, param_scales + 0 }, + { "max_elev", VIK_LAYER_PARAM_DOUBLE, VIK_LAYER_GROUP_NONE, N_("Max Elev:"), VIK_LAYER_WIDGET_SPINBUTTON, param_scales + 0 }, + { "line_thickness", VIK_LAYER_PARAM_UINT, VIK_LAYER_GROUP_NONE, N_("Line Thickness:"), VIK_LAYER_WIDGET_SPINBUTTON, param_scales + 1 }, }; @@ -109,7 +113,7 @@ static gboolean dem_layer_download_release ( VikDEMLayer *vdl, GdkEventButton *e static gboolean dem_layer_download_click ( VikDEMLayer *vdl, GdkEventButton *event, VikViewport *vvp ); static VikToolInterface dem_tools[] = { - { "DEM Download/Import", (VikToolConstructorFunc) dem_layer_download_create, NULL, NULL, NULL, + { N_("DEM Download/Import"), (VikToolConstructorFunc) dem_layer_download_create, NULL, NULL, NULL, (VikToolMouseFunc) dem_layer_download_click, NULL, (VikToolMouseFunc) dem_layer_download_release, (VikToolKeyFunc) NULL, &cursor_demdl }, }; @@ -739,7 +743,7 @@ static void srtm_dem_download_thread ( DEMDownloadParams *p, gpointer threaddata continent_dir = srtm_continent_dir(intlat, intlon); if (!continent_dir) { - g_warning("No SRTM data available for %f, %f\n", p->lat, p->lon); + g_warning(N_("No SRTM data available for %f, %f\n"), p->lat, p->lon); return; } @@ -978,7 +982,7 @@ static gboolean dem_layer_download_release ( VikDEMLayer *vdl, GdkEventButton *e gchar *dem_file = NULL; if ( vdl->source == DEM_SOURCE_NONE ) - a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_LAYER(vdl), "No download source selected. Edit layer properties." ); + a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_LAYER(vdl), _("No download source selected. Edit layer properties.") ); vik_viewport_screen_to_coord ( vvp, event->x, event->y, &coord ); vik_coord_to_latlon ( &coord, &ll ); @@ -1001,7 +1005,7 @@ static gboolean dem_layer_download_release ( VikDEMLayer *vdl, GdkEventButton *e // TODO: check if already in filelist if ( ! dem_layer_add_file(vdl, full_path) ) { - gchar *tmp = g_strdup_printf ( "Downloading DEM %s ", dem_file ); + gchar *tmp = g_strdup_printf ( _("Downloading DEM %s"), dem_file ); DEMDownloadParams *p = g_malloc(sizeof(DEMDownloadParams)); p->dest = g_strdup(full_path); p->lat = ll.lat; diff --git a/src/vikfileentry.c b/src/vikfileentry.c index 0d949316..c9acf7b9 100644 --- a/src/vikfileentry.c +++ b/src/vikfileentry.c @@ -19,7 +19,12 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include +#include #include "vikfileentry.h" @@ -59,7 +64,7 @@ GtkWidget *vik_file_entry_new () { VikFileEntry *vfe = VIK_FILE_ENTRY ( g_object_new ( VIK_FILE_ENTRY_TYPE, NULL ) ); vfe->entry = gtk_entry_new (); - vfe->button = gtk_button_new_with_label ( "Browse..." ); + vfe->button = gtk_button_new_with_label ( _("Browse...") ); g_signal_connect_swapped ( G_OBJECT(vfe->button), "clicked", G_CALLBACK(choose_file), vfe ); gtk_box_pack_start ( GTK_BOX(vfe), vfe->entry, TRUE, TRUE, 3 ); @@ -86,7 +91,7 @@ static void choose_file ( VikFileEntry *vfe ) { GtkWidget *win; g_assert ( (win = gtk_widget_get_toplevel(GTK_WIDGET(vfe))) ); - vfe->file_selector = gtk_file_selection_new ("Choose file"); + vfe->file_selector = gtk_file_selection_new (_("Choose file")); gtk_window_set_transient_for ( GTK_WINDOW(vfe->file_selector), GTK_WINDOW(win) ); gtk_window_set_destroy_with_parent ( GTK_WINDOW(vfe->file_selector), TRUE ); } diff --git a/src/vikfilelist.c b/src/vikfilelist.c index 1fc8828c..c5a2590b 100644 --- a/src/vikfilelist.c +++ b/src/vikfilelist.c @@ -19,7 +19,12 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include +#include #include "vikfilelist.h" @@ -36,7 +41,7 @@ static void file_list_add ( VikFileList *vfl ) { GtkWidget *win; g_assert ( (win = gtk_widget_get_toplevel(GTK_WIDGET(vfl))) ); - vfl->file_selector = gtk_file_selection_new ("Choose file(s)"); + vfl->file_selector = gtk_file_selection_new (_("Choose file(s)")); gtk_file_selection_set_select_multiple ( GTK_FILE_SELECTION(vfl->file_selector), TRUE ); gtk_window_set_transient_for ( GTK_WINDOW(vfl->file_selector), GTK_WINDOW(win) ); gtk_window_set_destroy_with_parent ( GTK_WINDOW(vfl->file_selector), TRUE ); @@ -105,8 +110,8 @@ GtkWidget *vik_file_list_new ( const gchar *title ) gtk_widget_set_size_request ( vfl->treeview, 200, 100); - add_btn = gtk_button_new_with_label("Add..."); - del_btn = gtk_button_new_with_label("Delete"); + add_btn = gtk_button_new_with_label(_("Add...")); + del_btn = gtk_button_new_with_label(_("Delete")); g_signal_connect_swapped ( G_OBJECT(add_btn), "clicked", G_CALLBACK(file_list_add), vfl ); g_signal_connect_swapped ( G_OBJECT(del_btn), "clicked", G_CALLBACK(file_list_del), vfl ); @@ -134,7 +139,7 @@ static gboolean get_file_name(GtkTreeModel *model, GtkTreePath *path, GtkTreeIte { gchar *str; gtk_tree_model_get ( model, iter, 0, &str, -1 ); - g_debug("get_file_name: %s", str); + g_debug ("%s: %s", __FUNCTION__, str); (*list) = g_list_append((*list), g_strdup(str)); return FALSE; } diff --git a/src/vikgeoreflayer.c b/src/vikgeoreflayer.c index 9d82bdb9..53b62f6c 100644 --- a/src/vikgeoreflayer.c +++ b/src/vikgeoreflayer.c @@ -19,10 +19,15 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "viking.h" #include "vikgeoreflayer_pixmap.h" #include #include +#include #include "icons/icons.h" @@ -58,11 +63,11 @@ static gpointer georef_layer_zoom_create ( VikWindow *vw, VikViewport *vvp); static gboolean georef_layer_zoom_press ( VikGeorefLayer *vgl, GdkEventButton *event, VikViewport *vvp ); static VikToolInterface georef_tools[] = { - { "Georef Move Map", (VikToolConstructorFunc) georef_layer_move_create, NULL, NULL, NULL, + { N_("Georef Move Map"), (VikToolConstructorFunc) georef_layer_move_create, NULL, NULL, NULL, (VikToolMouseFunc) georef_layer_move_press, NULL, (VikToolMouseFunc) georef_layer_move_release, (VikToolKeyFunc) NULL, &cursor_geomove }, - { "Georef Zoom Tool", (VikToolConstructorFunc) georef_layer_zoom_create, NULL, NULL, NULL, + { N_("Georef Zoom Tool"), (VikToolConstructorFunc) georef_layer_zoom_create, NULL, NULL, NULL, (VikToolMouseFunc) georef_layer_zoom_press, NULL, NULL, (VikToolKeyFunc) NULL, &cursor_geozoom }, }; @@ -260,7 +265,7 @@ static void georef_layer_load_image ( VikGeorefLayer *vgl ) if (gx) { - g_warning ( "Couldn't open image file: %s", gx->message ); + g_warning ( _("Couldn't open image file: %s"), gx->message ); g_error_free ( gx ); } else @@ -285,7 +290,7 @@ static gboolean world_file_read_line ( gchar *buffer, gint size, FILE *f, GtkWid { if (!fgets ( buffer, 1024, f )) { - a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_WIDGET(widget), "Unexpected end of file reading World file." ); + a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_WIDGET(widget), _("Unexpected end of file reading World file.") ); g_free ( buffer ); fclose ( f ); return FALSE; @@ -300,7 +305,7 @@ static gboolean world_file_read_line ( gchar *buffer, gint size, FILE *f, GtkWid static void georef_layer_dialog_load ( GtkWidget *pass_along[4] ) { - GtkWidget *file_selector = gtk_file_selection_new ("Choose World file"); + GtkWidget *file_selector = gtk_file_selection_new (_("Choose World file")); if ( gtk_dialog_run ( GTK_DIALOG ( file_selector ) ) == GTK_RESPONSE_OK ) { @@ -308,7 +313,7 @@ static void georef_layer_dialog_load ( GtkWidget *pass_along[4] ) gtk_widget_destroy ( file_selector ); if ( !f ) { - a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_WIDGET(pass_along[0]), "The World file you requested could not be opened for reading." ); + a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_WIDGET(pass_along[0]), _("The World file you requested could not be opened for reading.") ); return; } else @@ -339,7 +344,7 @@ We need a static void georef_layer_export_params ( gpointer *pass_along[2] ) { VikGeorefLayer *vgl = VIK_GEOREF_LAYER(pass_along[0]); - GtkWidget *file_selector = gtk_file_selection_new ("Choose World file"); + GtkWidget *file_selector = gtk_file_selection_new (_("Choose World file")); if ( gtk_dialog_run ( GTK_DIALOG ( file_selector ) ) == GTK_RESPONSE_OK ) { @@ -347,7 +352,7 @@ static void georef_layer_export_params ( gpointer *pass_along[2] ) gtk_widget_destroy ( file_selector ); if ( !f ) { - a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_WIDGET(pass_along[0]), "The file you requested could not be opened for writing." ); + a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_WIDGET(pass_along[0]), _("The file you requested could not be opened for writing.") ); return; } else @@ -363,7 +368,7 @@ static void georef_layer_export_params ( gpointer *pass_along[2] ) /* returns TRUE if OK was pressed. */ static gboolean georef_layer_dialog ( VikGeorefLayer **vgl, gpointer vp, GtkWindow *w ) { - GtkWidget *dialog = gtk_dialog_new_with_buttons ("Layer Properties", + GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Layer Properties"), w, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, @@ -379,25 +384,25 @@ static gboolean georef_layer_dialog ( VikGeorefLayer **vgl, gpointer vp, GtkWind gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(dialog)->vbox), table, TRUE, TRUE, 0 ); wfp_hbox = gtk_hbox_new ( FALSE, 0 ); - wfp_label = gtk_label_new ( "World File Parameters:" ); - wfp_button = gtk_button_new_with_label ( "Load From File..." ); + wfp_label = gtk_label_new ( _("World File Parameters:") ); + wfp_button = gtk_button_new_with_label ( _("Load From File...") ); gtk_box_pack_start ( GTK_BOX(wfp_hbox), wfp_label, TRUE, TRUE, 0 ); gtk_box_pack_start ( GTK_BOX(wfp_hbox), wfp_button, FALSE, FALSE, 3 ); - ce_label = gtk_label_new ( "Corner pixel easting:" ); + ce_label = gtk_label_new ( _("Corner pixel easting:") ); ce_spin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( 4, 0.0, 1500000.0, 1, 5, 5 ), 1, 4 ); - cn_label = gtk_label_new ( "Corner pixel northing:" ); + cn_label = gtk_label_new ( _("Corner pixel northing:") ); cn_spin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( 4, 0.0, 9000000.0, 1, 5, 5 ), 1, 4 ); - xlabel = gtk_label_new ( "X (easting) scale (mpp): "); - ylabel = gtk_label_new ( "Y (northing) scale (mpp): "); + xlabel = gtk_label_new ( _("X (easting) scale (mpp): ")); + ylabel = gtk_label_new ( _("Y (northing) scale (mpp): ")); xspin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( 4, VIK_VIEWPORT_MIN_ZOOM, VIK_VIEWPORT_MAX_ZOOM, 1, 5, 5 ), 1, 8 ); yspin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( 4, VIK_VIEWPORT_MIN_ZOOM, VIK_VIEWPORT_MAX_ZOOM, 1, 5, 5 ), 1, 8 ); - imagelabel = gtk_label_new ( "Map Image:" ); + imagelabel = gtk_label_new ( _("Map Image:") ); imageentry = vik_file_entry_new (); if (*vgl) @@ -501,17 +506,17 @@ static void georef_layer_add_menu_items ( VikGeorefLayer *vgl, GtkMenu *menu, gp gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Zoom to Fit Map" ); + item = gtk_menu_item_new_with_label ( _("Zoom to Fit Map") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(georef_layer_zoom_to_fit), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Goto Map Center" ); + item = gtk_menu_item_new_with_label ( _("Goto Map Center") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(georef_layer_goto_center), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Export to World File" ); + item = gtk_menu_item_new_with_label ( _("Export to World File") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(georef_layer_export_params), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); diff --git a/src/vikgpslayer.c b/src/vikgpslayer.c index efcb4ec2..55ab911a 100644 --- a/src/vikgpslayer.c +++ b/src/vikgpslayer.c @@ -32,6 +32,7 @@ #include #include #include +#include #ifdef VIK_CONFIG_REALTIME_GPS_TRACKING #include #endif @@ -101,15 +102,15 @@ static gchar *params_groups[] = { enum {GROUP_DATA_MODE, GROUP_REALTIME_MODE}; static VikLayerParam gps_layer_params[] = { - { "gps_protocol", VIK_LAYER_PARAM_UINT, GROUP_DATA_MODE, "GPS Protocol:", VIK_LAYER_WIDGET_COMBOBOX, params_protocols, NULL}, - { "gps_port", VIK_LAYER_PARAM_UINT, GROUP_DATA_MODE, "Serial Port:", VIK_LAYER_WIDGET_COMBOBOX, params_ports, NULL}, + { "gps_protocol", VIK_LAYER_PARAM_UINT, GROUP_DATA_MODE, N_("GPS Protocol:"), VIK_LAYER_WIDGET_COMBOBOX, params_protocols, NULL}, + { "gps_port", VIK_LAYER_PARAM_UINT, GROUP_DATA_MODE, N_("Serial Port:"), VIK_LAYER_WIDGET_COMBOBOX, params_ports, NULL}, #ifdef VIK_CONFIG_REALTIME_GPS_TRACKING - { "record_tracking", VIK_LAYER_PARAM_BOOLEAN, GROUP_REALTIME_MODE, "Recording tracks", VIK_LAYER_WIDGET_CHECKBUTTON}, - { "center_start_tracking", VIK_LAYER_PARAM_BOOLEAN, GROUP_REALTIME_MODE, "Jump to current position on start", VIK_LAYER_WIDGET_CHECKBUTTON}, - { "centered_tracking", VIK_LAYER_PARAM_BOOLEAN, GROUP_REALTIME_MODE, "Keep current position at center", VIK_LAYER_WIDGET_CHECKBUTTON}, - { "gpsd_host", VIK_LAYER_PARAM_STRING, GROUP_REALTIME_MODE, "Gpsd Host:", VIK_LAYER_WIDGET_ENTRY}, - { "gpsd_port", VIK_LAYER_PARAM_STRING, GROUP_REALTIME_MODE, "Gpsd Port:", VIK_LAYER_WIDGET_ENTRY}, + { "record_tracking", VIK_LAYER_PARAM_BOOLEAN, GROUP_REALTIME_MODE, N_("Recording tracks"), VIK_LAYER_WIDGET_CHECKBUTTON}, + { "center_start_tracking", VIK_LAYER_PARAM_BOOLEAN, GROUP_REALTIME_MODE, N_("Jump to current position on start"), VIK_LAYER_WIDGET_CHECKBUTTON}, + { "centered_tracking", VIK_LAYER_PARAM_BOOLEAN, GROUP_REALTIME_MODE, N_("Keep current position at center"), VIK_LAYER_WIDGET_CHECKBUTTON}, + { "gpsd_host", VIK_LAYER_PARAM_STRING, GROUP_REALTIME_MODE, N_("Gpsd Host:"), VIK_LAYER_WIDGET_ENTRY}, + { "gpsd_port", VIK_LAYER_PARAM_STRING, GROUP_REALTIME_MODE, N_("Gpsd Port:"), VIK_LAYER_WIDGET_ENTRY}, #endif /* VIK_CONFIG_REALTIME_GPS_TRACKING */ }; enum { @@ -173,9 +174,9 @@ enum {TRW_DOWNLOAD=0, TRW_UPLOAD, #endif NUM_TRW}; static gchar * trw_names[] = { - "GPS Download", "GPS Upload", + N_("GPS Download"), N_("GPS Upload"), #ifdef VIK_CONFIG_REALTIME_GPS_TRACKING - "GPS Realtime Tracking", + N_("GPS Realtime Tracking"), #endif }; @@ -339,13 +340,13 @@ static gboolean gps_layer_set_param ( VikGpsLayer *vgl, guint16 id, VikLayerPara if (data.u < NUM_PROTOCOLS) vgl->protocol_id = data.u; else - g_warning("Unknown GPS Protocol"); + g_warning(_("Unknown GPS Protocol")); break; case PARAM_PORT: if (data.u < NUM_PORTS) vgl->serial_port_id = data.u; else - g_warning("Unknown serial port device"); + g_warning(_("Unknown serial port device")); break; #ifdef VIK_CONFIG_REALTIME_GPS_TRACKING case PARAM_GPSD_HOST: @@ -405,7 +406,7 @@ static VikLayerParamData gps_layer_get_param ( VikGpsLayer *vgl, guint16 id ) break; #endif /* VIK_CONFIG_REALTIME_GPS_TRACKING */ default: - g_warning("gps_layer_get_param(): unknown parameter"); + g_warning(_("%s: unknown parameter"), __FUNCTION__); } return rv; @@ -502,12 +503,12 @@ static void gps_layer_add_menu_items( VikGpsLayer *vgl, GtkMenu *menu, gpointer gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Upload to GPS" ); + item = gtk_menu_item_new_with_label ( _("Upload to GPS") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(gps_upload_cb), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Download from GPS" ); + item = gtk_menu_item_new_with_label ( _("Download from GPS") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(gps_download_cb), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); @@ -525,17 +526,17 @@ static void gps_layer_add_menu_items( VikGpsLayer *vgl, GtkMenu *menu, gpointer gtk_widget_show ( item ); #endif /* VIK_CONFIG_REALTIME_GPS_TRACKING */ - item = gtk_menu_item_new_with_label ( "Empty Upload" ); + item = gtk_menu_item_new_with_label ( _("Empty Upload") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(gps_empty_upload_cb), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Empty Download" ); + item = gtk_menu_item_new_with_label ( _("Empty Download") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(gps_empty_download_cb), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Empty All" ); + item = gtk_menu_item_new_with_label ( _("Empty All") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(gps_empty_all_cb), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); @@ -594,7 +595,7 @@ static void vik_gps_layer_realize ( VikGpsLayer *vgl, VikTreeview *vt, GtkTreeIt for (ix = 0; ix < NUM_TRW; ix++) { VikLayer * trw = VIK_LAYER(vgl->trw_children[ix]); vik_treeview_add_layer ( VIK_LAYER(vgl)->vt, layer_iter, &iter, - trw_names[ix], vgl, + _(trw_names[ix]), vgl, trw, trw->type, trw->type ); if ( ! trw->visible ) vik_treeview_item_set_visible ( VIK_LAYER(vgl)->vt, &iter, FALSE ); @@ -667,8 +668,8 @@ static void set_total_count(gint cnt, GpsSession *sess) g_mutex_lock(sess->mutex); if (sess->ok) { g_sprintf(s, "%s %d %s...", - (sess->direction == GPS_DOWN) ? "Downloading" : "Uploading", cnt, - (sess->progress_label == sess->wp_label) ? "waypoints" : "trackpoints"); + (sess->direction == GPS_DOWN) ? _("Downloading") : _("Uploading"), cnt, + (sess->progress_label == sess->wp_label) ? _("waypoints") : _("trackpoints")); gtk_label_set_text ( GTK_LABEL(sess->progress_label), s ); gtk_widget_show ( sess->progress_label ); sess->total_count = cnt; @@ -680,15 +681,15 @@ static void set_total_count(gint cnt, GpsSession *sess) static void set_current_count(gint cnt, GpsSession *sess) { gchar s[128]; - gchar *dir_str = (sess->direction == GPS_DOWN) ? "Downloaded" : "Uploaded"; + const gchar *dir_str = (sess->direction == GPS_DOWN) ? _("Downloaded") : _("Uploaded"); gdk_threads_enter(); g_mutex_lock(sess->mutex); if (sess->ok) { if (cnt < sess->total_count) { - g_sprintf(s, "%s %d out of %d %s...", dir_str, cnt, sess->total_count, (sess->progress_label == sess->wp_label) ? "waypoints" : "trackpoints"); + g_sprintf(s, _("%s %d out of %d %s..."), dir_str, cnt, sess->total_count, (sess->progress_label == sess->wp_label) ? _("waypoints") : _("trackpoints")); } else { - g_sprintf(s, "%s %d %s.", dir_str, cnt, (sess->progress_label == sess->wp_label) ? "waypoints" : "trackpoints"); + g_sprintf(s, "%s %d %s.", dir_str, cnt, (sess->progress_label == sess->wp_label) ? _("waypoints") : _("trackpoints")); } gtk_label_set_text ( GTK_LABEL(sess->progress_label), s ); } @@ -702,7 +703,7 @@ static void set_gps_info(const gchar *info, GpsSession *sess) gdk_threads_enter(); g_mutex_lock(sess->mutex); if (sess->ok) { - g_sprintf(s, "GPS Device: %s", info); + g_sprintf(s, _("GPS Device: %s"), info); gtk_label_set_text ( GTK_LABEL(sess->gps_label), s ); } g_mutex_unlock(sess->mutex); @@ -871,12 +872,12 @@ static void gps_comm_thread(GpsSession *sess) gdk_threads_enter(); if (!result) { - gtk_label_set_text ( GTK_LABEL(sess->status_label), "Error: couldn't find gpsbabel." ); + gtk_label_set_text ( GTK_LABEL(sess->status_label), _("Error: couldn't find gpsbabel.") ); } else { g_mutex_lock(sess->mutex); if (sess->ok) { - gtk_label_set_text ( GTK_LABEL(sess->status_label), "Done." ); + gtk_label_set_text ( GTK_LABEL(sess->status_label), _("Done.") ); gtk_dialog_set_response_sensitive ( GTK_DIALOG(sess->dialog), GTK_RESPONSE_ACCEPT, TRUE ); gtk_dialog_set_response_sensitive ( GTK_DIALOG(sess->dialog), GTK_RESPONSE_REJECT, FALSE ); } else { @@ -908,19 +909,19 @@ static gint gps_comm(VikTrwLayer *vtl, gps_dir dir, vik_gps_proto proto, gchar * sess->ok = TRUE; sess->cmd_args = g_strdup_printf("-D 9 -t -w -%c %s", (dir == GPS_DOWN) ? 'i' : 'o', protocols_args[proto]); - sess->window_title = (dir == GPS_DOWN) ? "GPS Download" : "GPS Upload"; + sess->window_title = (dir == GPS_DOWN) ? _("GPS Download") : _("GPS Upload"); sess->dialog = gtk_dialog_new_with_buttons ( "", VIK_GTK_WINDOW_FROM_LAYER(vtl), 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL ); gtk_dialog_set_response_sensitive ( GTK_DIALOG(sess->dialog), GTK_RESPONSE_ACCEPT, FALSE ); gtk_window_set_title ( GTK_WINDOW(sess->dialog), sess->window_title ); - sess->status_label = gtk_label_new ("Status: detecting gpsbabel"); + sess->status_label = gtk_label_new (_("Status: detecting gpsbabel")); gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(sess->dialog)->vbox), sess->status_label, FALSE, FALSE, 5 ); gtk_widget_show_all(sess->status_label); - sess->gps_label = gtk_label_new ("GPS device: N/A"); + sess->gps_label = gtk_label_new (_("GPS device: N/A")); sess->ver_label = gtk_label_new (""); sess->id_label = gtk_label_new (""); sess->wp_label = gtk_label_new (""); diff --git a/src/viklayer.c b/src/viklayer.c index d40abc62..94b961e6 100644 --- a/src/viklayer.c +++ b/src/viklayer.c @@ -19,6 +19,12 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + #include "viking.h" #include @@ -175,7 +181,9 @@ VikLayer *vik_layer_create ( gint type, gpointer vp, GtkWindow *w, gboolean inte if ( interactive ) { if ( vik_layer_properties ( new_layer, vp ) ) - vik_layer_rename ( VIK_LAYER(new_layer), vik_layer_interfaces[type]->name ); + /* We translate the name here */ + /* in order to avoid translating name set by user */ + vik_layer_rename ( VIK_LAYER(new_layer), _(vik_layer_interfaces[type]->name) ); else { g_object_unref ( G_OBJECT(new_layer) ); /* cancel that */ diff --git a/src/viklayerspanel.c b/src/viklayerspanel.c index e8d182a6..ddbcc47d 100644 --- a/src/viklayerspanel.c +++ b/src/viklayerspanel.c @@ -19,10 +19,16 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "viking.h" #include +#include + enum { VLP_UPDATE_SIGNAL, VLP_LAST_SIGNAL @@ -50,11 +56,11 @@ struct _VikLayersPanel { }; static GtkItemFactoryEntry base_entries[] = { - { "/C_ut", NULL, (GtkItemFactoryCallback) vik_layers_panel_cut_selected, -1, "", GTK_STOCK_CUT }, - { "/_Copy", NULL, (GtkItemFactoryCallback) vik_layers_panel_copy_selected, -1, "", GTK_STOCK_COPY }, - { "/_Paste", NULL, (GtkItemFactoryCallback) vik_layers_panel_paste_selected, -1, "", GTK_STOCK_PASTE }, - { "/_Delete", NULL, (GtkItemFactoryCallback) vik_layers_panel_delete_selected, -1, "", GTK_STOCK_DELETE }, - { "/New Layer", NULL, NULL, -1, "" }, + { N_("/C_ut"), NULL, (GtkItemFactoryCallback) vik_layers_panel_cut_selected, -1, "", GTK_STOCK_CUT }, + { N_("/_Copy"), NULL, (GtkItemFactoryCallback) vik_layers_panel_copy_selected, -1, "", GTK_STOCK_COPY }, + { N_("/_Paste"), NULL, (GtkItemFactoryCallback) vik_layers_panel_paste_selected, -1, "", GTK_STOCK_PASTE }, + { N_("/_Delete"), NULL, (GtkItemFactoryCallback) vik_layers_panel_delete_selected, -1, "", GTK_STOCK_DELETE }, + { N_("/New Layer"), NULL, NULL, -1, "" }, }; #define NUM_BASE_ENTRIES 5 @@ -136,7 +142,7 @@ static void layers_panel_init ( VikLayersPanel *vlp ) vlp->vt = vik_treeview_new ( ); vlp->toplayer = vik_aggregate_layer_new (); - vik_layer_rename ( VIK_LAYER(vlp->toplayer), "Top Layer"); + vik_layer_rename ( VIK_LAYER(vlp->toplayer), _("Top Layer")); g_signal_connect_swapped ( G_OBJECT(vlp->toplayer), "update", G_CALLBACK(vik_layers_panel_emit_update), vlp ); vik_treeview_add_layer ( vlp->vt, NULL, &(vlp->toplayer_iter), VIK_LAYER(vlp->toplayer)->name, NULL, vlp->toplayer, VIK_LAYER_AGGREGATE, VIK_LAYER_AGGREGATE ); @@ -434,7 +440,7 @@ gboolean vik_layers_panel_properties ( VikLayersPanel *vlp ) if ( vik_treeview_get_selected_iter ( vlp->vt, &iter ) && vik_treeview_item_get_type ( vlp->vt, &iter ) == VIK_TREEVIEW_TYPE_LAYER ) { if ( vik_treeview_item_get_data ( vlp->vt, &iter ) == VIK_LAYER_AGGREGATE ) - a_dialog_info_msg ( VIK_GTK_WINDOW_FROM_WIDGET(vlp), "Aggregate Layers have no settable properties." ); + a_dialog_info_msg ( VIK_GTK_WINDOW_FROM_WIDGET(vlp), _("Aggregate Layers have no settable properties.") ); vik_layer_properties ( VIK_LAYER( vik_treeview_item_get_pointer ( vlp->vt, &iter ) ), vlp->vvp ); return TRUE; } @@ -479,7 +485,7 @@ void vik_layers_panel_cut_selected ( VikLayersPanel *vlp ) vik_layers_panel_emit_update ( vlp ); } else - a_dialog_info_msg ( VIK_GTK_WINDOW_FROM_WIDGET(vlp), "You cannot cut the Top Layer." ); + a_dialog_info_msg ( VIK_GTK_WINDOW_FROM_WIDGET(vlp), _("You cannot cut the Top Layer.") ); } } @@ -528,7 +534,7 @@ void vik_layers_panel_delete_selected ( VikLayersPanel *vlp ) } } else - a_dialog_info_msg ( VIK_GTK_WINDOW_FROM_WIDGET(vlp), "You cannot delete the Top Layer." ); + a_dialog_info_msg ( VIK_GTK_WINDOW_FROM_WIDGET(vlp), _("You cannot delete the Top Layer.") ); } else if (type == VIK_TREEVIEW_TYPE_SUBLAYER) { VikLayer *sel = vik_layers_panel_get_selected ( vlp ); @@ -612,7 +618,7 @@ VikAggregateLayer *vik_layers_panel_get_top_layer ( VikLayersPanel *vlp ) void vik_layers_panel_clear ( VikLayersPanel *vlp ) { - if ( (! vik_aggregate_layer_is_empty(vlp->toplayer)) && a_dialog_overwrite ( VIK_GTK_WINDOW_FROM_WIDGET(vlp), "Are you sure you wish to delete all layers?", NULL ) ) + if ( (! vik_aggregate_layer_is_empty(vlp->toplayer)) && a_dialog_overwrite ( VIK_GTK_WINDOW_FROM_WIDGET(vlp), _("Are you sure you wish to delete all layers?"), NULL ) ) vik_aggregate_layer_clear ( vlp->toplayer ); /* simply deletes all layers */ } diff --git a/src/vikmapslayer.c b/src/vikmapslayer.c index 47b672d3..a9cd76a0 100644 --- a/src/vikmapslayer.c +++ b/src/vikmapslayer.c @@ -21,6 +21,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #define MAX_SHRINKFACTOR 8.0000001 /* zoom 1 viewing 8-tiles */ #define MIN_SHRINKFACTOR 0.0312499 /* zoom 32 viewing 1-tiles */ @@ -28,6 +32,8 @@ #include #include +#include + #include #include #include @@ -74,7 +80,7 @@ static GList *params_maptypes_ids = NULL; /******** MAPZOOMS *********/ -static gchar *params_mapzooms[] = { "Use Viking Zoom Level", "0.25", "1", "2", "4", "8", "16", "32", "64", "128", "256", "512", "1024", "USGS 10k", "USGS 24k", "USGS 25k", "USGS 50k", "USGS 100k", "USGS 200k", "USGS 250k", NULL }; +static gchar *params_mapzooms[] = { N_("Use Viking Zoom Level"), "0.25", "1", "2", "4", "8", "16", "32", "64", "128", "256", "512", "1024", "USGS 10k", "USGS 24k", "USGS 25k", "USGS 50k", "USGS 100k", "USGS 200k", "USGS 250k", NULL }; static gdouble __mapzooms_x[] = { 0.0, 0.25, 1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0, 256.0, 512.0, 1024.0, 1.016, 2.4384, 2.54, 5.08, 10.16, 20.32, 25.4 }; static gdouble __mapzooms_y[] = { 0.0, 0.25, 1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0, 256.0, 512.0, 1024.0, 1.016, 2.4384, 2.54, 5.08, 10.16, 20.32, 25.4 }; @@ -105,23 +111,23 @@ static VikLayerParamScale params_scales[] = { }; VikLayerParam maps_layer_params[] = { - { "mode", VIK_LAYER_PARAM_UINT, VIK_LAYER_GROUP_NONE, "Map Type:", VIK_LAYER_WIDGET_RADIOGROUP, NULL, NULL }, - { "directory", VIK_LAYER_PARAM_STRING, VIK_LAYER_GROUP_NONE, "Maps Directory (Optional):", VIK_LAYER_WIDGET_FILEENTRY }, - { "alpha", VIK_LAYER_PARAM_UINT, VIK_LAYER_GROUP_NONE, "Alpha:", VIK_LAYER_WIDGET_HSCALE, params_scales }, - { "autodownload", VIK_LAYER_PARAM_BOOLEAN, VIK_LAYER_GROUP_NONE, "Autodownload maps:", VIK_LAYER_WIDGET_CHECKBUTTON }, - { "mapzoom", VIK_LAYER_PARAM_UINT, VIK_LAYER_GROUP_NONE, "Zoom Level:", VIK_LAYER_WIDGET_COMBOBOX, params_mapzooms }, + { "mode", VIK_LAYER_PARAM_UINT, VIK_LAYER_GROUP_NONE, N_("Map Type:"), VIK_LAYER_WIDGET_RADIOGROUP, NULL, NULL }, + { "directory", VIK_LAYER_PARAM_STRING, VIK_LAYER_GROUP_NONE, N_("Maps Directory (Optional):"), VIK_LAYER_WIDGET_FILEENTRY }, + { "alpha", VIK_LAYER_PARAM_UINT, VIK_LAYER_GROUP_NONE, N_("Alpha:"), VIK_LAYER_WIDGET_HSCALE, params_scales }, + { "autodownload", VIK_LAYER_PARAM_BOOLEAN, VIK_LAYER_GROUP_NONE, N_("Autodownload maps:"), VIK_LAYER_WIDGET_CHECKBUTTON }, + { "mapzoom", VIK_LAYER_PARAM_UINT, VIK_LAYER_GROUP_NONE, N_("Zoom Level:"), VIK_LAYER_WIDGET_COMBOBOX, params_mapzooms }, }; enum { PARAM_MAPTYPE=0, PARAM_CACHE_DIR, PARAM_ALPHA, PARAM_AUTODOWNLOAD, PARAM_MAPZOOM, NUM_PARAMS }; static VikToolInterface maps_tools[] = { - { "Maps Download", (VikToolConstructorFunc) maps_layer_download_create, NULL, NULL, NULL, + { N_("Maps Download"), (VikToolConstructorFunc) maps_layer_download_create, NULL, NULL, NULL, (VikToolMouseFunc) maps_layer_download_click, NULL, (VikToolMouseFunc) maps_layer_download_release, (VikToolKeyFunc) NULL, &cursor_mapdl }, }; VikLayerInterface vik_maps_layer_interface = { - "Map", + N_("Map"), &mapslayer_pixbuf, maps_tools, @@ -377,7 +383,7 @@ static gboolean maps_layer_set_param ( VikMapsLayer *vml, guint16 id, VikLayerPa case PARAM_CACHE_DIR: maps_layer_set_cache_dir ( vml, data.s ); break; case PARAM_MAPTYPE: { gint maptype = map_uniq_id_to_index(data.u); - if ( maptype == NUM_MAP_TYPES ) g_warning("Unknown map type"); + if ( maptype == NUM_MAP_TYPES ) g_warning(_("Unknown map type")); else vml->maptype = maptype; break; } @@ -387,7 +393,7 @@ static gboolean maps_layer_set_param ( VikMapsLayer *vml, guint16 id, VikLayerPa vml->mapzoom_id = data.u; vml->xmapzoom = __mapzooms_x [data.u]; vml->ymapzoom = __mapzooms_y [data.u]; - }else g_warning ("Unknown Map Zoom"); break; + }else g_warning (_("Unknown Map Zoom")); break; } return TRUE; } @@ -456,7 +462,7 @@ static void maps_layer_post_read (VikLayer *vl, VikViewport *vp, gboolean from_f map_type = MAPS_LAYER_NTH_TYPE(vml->maptype); if (map_type->drawmode != vp_drawmode) { const gchar *drawmode_name = vik_viewport_get_drawmode_name (VIK_VIEWPORT(vp), map_type->drawmode); - gchar *msg = g_strdup_printf("New map cannot be displayed in the current drawmode.\nSelect \"%s\" from View menu to view it.", drawmode_name); + gchar *msg = g_strdup_printf(_("New map cannot be displayed in the current drawmode.\nSelect \"%s\" from View menu to view it."), drawmode_name); a_dialog_warning_msg ( VIK_GTK_WINDOW_FROM_LAYER(vml), msg ); g_free(msg); } @@ -533,7 +539,7 @@ static GdkPixbuf *get_pixbuf( VikMapsLayer *vml, gint mode, MapCoord *mapcoord, if (gx) { if ( gx->domain != GDK_PIXBUF_ERROR || gx->code != GDK_PIXBUF_ERROR_CORRUPT_IMAGE ) - g_warning ( "Couldn't open image file: %s", gx->message ); + g_warning ( _("Couldn't open image file: %s"), gx->message ); g_error_free ( gx ); if ( pixbuf ) @@ -598,7 +604,7 @@ static void maps_layer_draw_section ( VikMapsLayer *vml, VikViewport *vvp, VikCo if ( xshrinkfactor > REAL_MIN_SHRINKFACTOR && yshrinkfactor > REAL_MIN_SHRINKFACTOR ) existence_only = TRUE; else { - g_warning ( "Cowardly refusing to draw tiles or existence of tiles beyond %d zoom out factor", (int)( 1.0/REAL_MIN_SHRINKFACTOR)); + g_warning ( _("Cowardly refusing to draw tiles or existence of tiles beyond %d zoom out factor"), (int)( 1.0/REAL_MIN_SHRINKFACTOR)); return; } } @@ -907,7 +913,7 @@ static void start_download_thread ( VikMapsLayer *vml, VikViewport *vvp, const V if ( mdi->mapstoget ) { - gchar *tmp = g_strdup_printf ( "%s %s%d %s %s...", redownload ? "Redownloading" : "Downloading", redownload == REDOWNLOAD_BAD ? "up to " : "", mdi->mapstoget, MAPS_LAYER_NTH_LABEL(vml->maptype), (mdi->mapstoget == 1) ? "map" : "maps" ); + gchar *tmp = g_strdup_printf ( "%s %s%d %s %s...", redownload ? _("Redownloading") : _("Downloading"), redownload == REDOWNLOAD_BAD ? _("up to ") : "", mdi->mapstoget, MAPS_LAYER_NTH_LABEL(vml->maptype), ngettext("map", "maps", mdi->mapstoget) ); g_object_weak_ref(G_OBJECT(mdi->vml), weak_ref_cb, mdi); /* launch the thread */ @@ -974,7 +980,13 @@ void maps_layer_download_section_without_redraw( VikMapsLayer *vml, VikViewport mdi->mapcoord.x = mdi->mapcoord.y = 0; /* for cleanup -- no current map */ if (mdi->mapstoget) { - gchar *tmp = g_strdup_printf ( "%s %d %s %s...", "Downloading", mdi->mapstoget, MAPS_LAYER_NTH_LABEL(vml->maptype), (mdi->mapstoget == 1) ? "map" : "maps" ); + gchar *tmp; + const gchar *fmt; + if (mdi->mapstoget == 1) + fmt = _("Downloading %d %s map..."); + else + fmt = _("Downloading %d %s maps..."); + tmp = g_strdup_printf ( fmt, mdi->mapstoget, MAPS_LAYER_NTH_LABEL(vml->maptype) ); g_object_weak_ref(G_OBJECT(mdi->vml), weak_ref_cb, mdi); /* launch the thread */ @@ -1028,11 +1040,11 @@ static gboolean maps_layer_download_release ( VikMapsLayer *vml, GdkEventButton GtkWidget *item; vml->dl_right_click_menu = GTK_MENU ( gtk_menu_new () ); - item = gtk_menu_item_new_with_label ( "Redownload bad map(s)" ); + item = gtk_menu_item_new_with_label ( _("Redownload bad map(s)") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(maps_layer_redownload_bad), vml ); gtk_menu_shell_append ( GTK_MENU_SHELL(vml->dl_right_click_menu), item ); - item = gtk_menu_item_new_with_label ( "Redownload all map(s)" ); + item = gtk_menu_item_new_with_label ( _("Redownload all map(s)") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(maps_layer_redownload_all), vml ); gtk_menu_shell_append ( GTK_MENU_SHELL(vml->dl_right_click_menu), item ); } @@ -1112,12 +1124,12 @@ static void download_onscreen_maps ( gpointer vml_vvp[2], gint redownload ) start_download_thread ( vml, vvp, &ul, &br, redownload ); else if (map_type->drawmode != vp_drawmode) { const gchar *drawmode_name = vik_viewport_get_drawmode_name (vvp, map_type->drawmode); - gchar *err = g_strdup_printf("Wrong drawmode for this map.\nSelect \"%s\" from View menu and try again.", drawmode_name); + gchar *err = g_strdup_printf(_("Wrong drawmode for this map.\nSelect \"%s\" from View menu and try again."), _(drawmode_name)); a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_LAYER(vml), err ); g_free(err); } else - a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_LAYER(vml), "Wrong zoom level for this map." ); + a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_LAYER(vml), _("Wrong zoom level for this map.") ); } @@ -1142,12 +1154,12 @@ static void maps_layer_add_menu_items ( VikMapsLayer *vml, GtkMenu *menu, VikLay gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Download Onscreen Maps" ); + item = gtk_menu_item_new_with_label ( _("Download Onscreen Maps") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(maps_layer_download_onscreen_maps), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Refresh Onscreen Tiles" ); + item = gtk_menu_item_new_with_label ( _("Refresh Onscreen Tiles") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(maps_layer_redownload_all_onscreen_maps), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); diff --git a/src/viktreeview.c b/src/viktreeview.c index 70428030..08bec791 100644 --- a/src/viktreeview.c +++ b/src/viktreeview.c @@ -19,7 +19,13 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include +#include + #include #include "viking.h" @@ -194,7 +200,7 @@ static void treeview_add_columns ( VikTreeview *vt ) g_object_set (G_OBJECT (renderer), "xalign", 0.0, NULL); col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (vt), - -1, "Layer Name", + -1, _("Layer Name"), renderer, "text", NAME_COLUMN, "editable", EDITABLE_COLUMN, @@ -600,7 +606,7 @@ static gboolean treeview_drag_data_received (GtkTreeDragDest *drag_dest, GtkTree static gboolean treeview_drag_data_delete ( GtkTreeDragSource *drag_source, GtkTreePath *path ) { gchar *s_dest = gtk_tree_path_to_string(path); - g_print("delete data from %s\n", s_dest); + g_print(_("delete data from %s\n"), s_dest); g_free(s_dest); return FALSE; } diff --git a/src/viktrwlayer.c b/src/viktrwlayer.c index 4016be89..ae4df2db 100644 --- a/src/viktrwlayer.c +++ b/src/viktrwlayer.c @@ -55,6 +55,7 @@ #include #include +#include /* Relax some dependencies */ #if ! GLIB_CHECK_VERSION(2,12,0) @@ -286,41 +287,41 @@ static void waypoint_convert ( const gchar *name, VikWaypoint *wp, VikCoordMode static void track_convert ( const gchar *name, VikTrack *tr, VikCoordMode *dest_mode ); static VikToolInterface trw_layer_tools[] = { - { "Create Waypoint", (VikToolConstructorFunc) tool_new_waypoint_create, NULL, NULL, NULL, + { N_("Create Waypoint"), (VikToolConstructorFunc) tool_new_waypoint_create, NULL, NULL, NULL, (VikToolMouseFunc) tool_new_waypoint_click, NULL, NULL, (VikToolKeyFunc) NULL, &cursor_addwp }, - { "Create Track", (VikToolConstructorFunc) tool_new_track_create, NULL, NULL, NULL, + { N_("Create Track"), (VikToolConstructorFunc) tool_new_track_create, NULL, NULL, NULL, (VikToolMouseFunc) tool_new_track_click, (VikToolMouseFunc) tool_new_track_move, NULL, (VikToolKeyFunc) tool_new_track_key_press, &cursor_addtr }, - { "Begin Track", (VikToolConstructorFunc) tool_begin_track_create, NULL, NULL, NULL, + { N_("Begin Track"), (VikToolConstructorFunc) tool_begin_track_create, NULL, NULL, NULL, (VikToolMouseFunc) tool_begin_track_click, NULL, NULL, (VikToolKeyFunc) NULL, &cursor_begintr }, - { "Edit Waypoint", (VikToolConstructorFunc) tool_edit_waypoint_create, NULL, NULL, NULL, + { N_("Edit Waypoint"), (VikToolConstructorFunc) tool_edit_waypoint_create, NULL, NULL, NULL, (VikToolMouseFunc) tool_edit_waypoint_click, (VikToolMouseFunc) tool_edit_waypoint_move, (VikToolMouseFunc) tool_edit_waypoint_release, (VikToolKeyFunc) NULL, &cursor_edwp }, - { "Edit Trackpoint", (VikToolConstructorFunc) tool_edit_trackpoint_create, NULL, NULL, NULL, + { N_("Edit Trackpoint"), (VikToolConstructorFunc) tool_edit_trackpoint_create, NULL, NULL, NULL, (VikToolMouseFunc) tool_edit_trackpoint_click, (VikToolMouseFunc) tool_edit_trackpoint_move, (VikToolMouseFunc) tool_edit_trackpoint_release, (VikToolKeyFunc) NULL, &cursor_edtr }, - { "Show Picture", (VikToolConstructorFunc) tool_show_picture_create, NULL, NULL, NULL, + { N_("Show Picture"), (VikToolConstructorFunc) tool_show_picture_create, NULL, NULL, NULL, (VikToolMouseFunc) tool_show_picture_click, NULL, NULL, (VikToolKeyFunc) NULL, &cursor_showpic }, - { "Magic Scissors", (VikToolConstructorFunc) tool_magic_scissors_create, NULL, NULL, NULL, + { N_("Magic Scissors"), (VikToolConstructorFunc) tool_magic_scissors_create, NULL, NULL, NULL, (VikToolMouseFunc) tool_magic_scissors_click, NULL, NULL, (VikToolKeyFunc) NULL, &cursor_iscissors }, }; enum { TOOL_CREATE_WAYPOINT=0, TOOL_CREATE_TRACK, TOOL_BEGIN_TRACK, TOOL_EDIT_WAYPOINT, TOOL_EDIT_TRACKPOINT, TOOL_SHOW_PICTURE, NUM_TOOLS }; /****** PARAMETERS ******/ -static gchar *params_groups[] = { "Waypoints", "Tracks", "Waypoint Images" }; +static gchar *params_groups[] = { N_("Waypoints"), N_("Tracks"), N_("Waypoint Images") }; enum { GROUP_WAYPOINTS, GROUP_TRACKS, GROUP_IMAGES }; -static gchar *params_drawmodes[] = { "Draw by Track", "Draw by Velocity", "All Tracks Black", 0 }; -static gchar *params_wpsymbols[] = { "Filled Square", "Square", "Circle", "X", 0 }; +static gchar *params_drawmodes[] = { N_("Draw by Track"), N_("Draw by Velocity"), N_("All Tracks Black"), 0 }; +static gchar *params_wpsymbols[] = { N_("Filled Square"), N_("Square"), N_("Circle"), N_("X"), 0 }; static VikLayerParamScale params_scales[] = { @@ -342,34 +343,34 @@ VikLayerParam trw_layer_params[] = { { "tracks_visible", VIK_LAYER_PARAM_BOOLEAN, VIK_LAYER_NOT_IN_PROPERTIES }, { "waypoints_visible", VIK_LAYER_PARAM_BOOLEAN, VIK_LAYER_NOT_IN_PROPERTIES }, - { "drawmode", VIK_LAYER_PARAM_UINT, GROUP_TRACKS, "Track Drawing Mode:", VIK_LAYER_WIDGET_RADIOGROUP, NULL }, - { "drawlines", VIK_LAYER_PARAM_BOOLEAN, GROUP_TRACKS, "Draw Track Lines", VIK_LAYER_WIDGET_CHECKBUTTON }, - { "drawpoints", VIK_LAYER_PARAM_BOOLEAN, GROUP_TRACKS, "Draw Trackpoints", VIK_LAYER_WIDGET_CHECKBUTTON }, - { "drawelevation", VIK_LAYER_PARAM_BOOLEAN, GROUP_TRACKS, "Draw Elevation", VIK_LAYER_WIDGET_CHECKBUTTON }, - { "elevation_factor", VIK_LAYER_PARAM_UINT, GROUP_TRACKS, "Draw Elevation Height %:", VIK_LAYER_WIDGET_HSCALE, params_scales + 9 }, - - { "drawstops", VIK_LAYER_PARAM_BOOLEAN, GROUP_TRACKS, "Draw Stops", VIK_LAYER_WIDGET_CHECKBUTTON }, - { "stop_length", VIK_LAYER_PARAM_UINT, GROUP_TRACKS, "Min Stop Length (seconds):", VIK_LAYER_WIDGET_SPINBUTTON, params_scales + 8 }, - - { "line_thickness", VIK_LAYER_PARAM_UINT, GROUP_TRACKS, "Track Thickness:", VIK_LAYER_WIDGET_SPINBUTTON, params_scales + 0 }, - { "bg_line_thickness", VIK_LAYER_PARAM_UINT, GROUP_TRACKS, "Track BG Thickness:", VIK_LAYER_WIDGET_SPINBUTTON, params_scales + 6 }, - { "trackbgcolor", VIK_LAYER_PARAM_COLOR, GROUP_TRACKS, "Track Background Color", VIK_LAYER_WIDGET_COLOR, 0 }, - { "velocity_min", VIK_LAYER_PARAM_DOUBLE, GROUP_TRACKS, "Min Track Velocity:", VIK_LAYER_WIDGET_SPINBUTTON, params_scales + 1 }, - { "velocity_max", VIK_LAYER_PARAM_DOUBLE, GROUP_TRACKS, "Max Track Velocity:", VIK_LAYER_WIDGET_SPINBUTTON, params_scales + 2 }, - - { "drawlabels", VIK_LAYER_PARAM_BOOLEAN, GROUP_WAYPOINTS, "Draw Labels", VIK_LAYER_WIDGET_CHECKBUTTON }, - { "wpcolor", VIK_LAYER_PARAM_COLOR, GROUP_WAYPOINTS, "Waypoint Color:", VIK_LAYER_WIDGET_COLOR, 0 }, - { "wptextcolor", VIK_LAYER_PARAM_COLOR, GROUP_WAYPOINTS, "Waypoint Text:", VIK_LAYER_WIDGET_COLOR, 0 }, - { "wpbgcolor", VIK_LAYER_PARAM_COLOR, GROUP_WAYPOINTS, "Background:", VIK_LAYER_WIDGET_COLOR, 0 }, - { "wpbgand", VIK_LAYER_PARAM_BOOLEAN, GROUP_WAYPOINTS, "Fake BG Color Translucency:", VIK_LAYER_WIDGET_CHECKBUTTON, 0 }, - { "wpsymbol", VIK_LAYER_PARAM_UINT, GROUP_WAYPOINTS, "Waypoint marker:", VIK_LAYER_WIDGET_RADIOGROUP, NULL }, - { "wpsize", VIK_LAYER_PARAM_UINT, GROUP_WAYPOINTS, "Waypoint size:", VIK_LAYER_WIDGET_SPINBUTTON, params_scales + 7 }, - { "wpsyms", VIK_LAYER_PARAM_BOOLEAN, GROUP_WAYPOINTS, "Draw Waypoint Symbols:", VIK_LAYER_WIDGET_CHECKBUTTON }, - - { "drawimages", VIK_LAYER_PARAM_BOOLEAN, GROUP_IMAGES, "Draw Waypoint Images", VIK_LAYER_WIDGET_CHECKBUTTON }, - { "image_size", VIK_LAYER_PARAM_UINT, GROUP_IMAGES, "Image Size (pixels):", VIK_LAYER_WIDGET_HSCALE, params_scales + 3 }, - { "image_alpha", VIK_LAYER_PARAM_UINT, GROUP_IMAGES, "Image Alpha:", VIK_LAYER_WIDGET_HSCALE, params_scales + 4 }, - { "image_cache_size", VIK_LAYER_PARAM_UINT, GROUP_IMAGES, "Image Memory Cache Size:", VIK_LAYER_WIDGET_HSCALE, params_scales + 5 }, + { "drawmode", VIK_LAYER_PARAM_UINT, GROUP_TRACKS, N_("Track Drawing Mode:"), VIK_LAYER_WIDGET_RADIOGROUP, NULL }, + { "drawlines", VIK_LAYER_PARAM_BOOLEAN, GROUP_TRACKS, N_("Draw Track Lines"), VIK_LAYER_WIDGET_CHECKBUTTON }, + { "drawpoints", VIK_LAYER_PARAM_BOOLEAN, GROUP_TRACKS, N_("Draw Trackpoints"), VIK_LAYER_WIDGET_CHECKBUTTON }, + { "drawelevation", VIK_LAYER_PARAM_BOOLEAN, GROUP_TRACKS, N_("Draw Elevation"), VIK_LAYER_WIDGET_CHECKBUTTON }, + { "elevation_factor", VIK_LAYER_PARAM_UINT, GROUP_TRACKS, N_("Draw Elevation Height %:"), VIK_LAYER_WIDGET_HSCALE, params_scales + 9 }, + + { "drawstops", VIK_LAYER_PARAM_BOOLEAN, GROUP_TRACKS, N_("Draw Stops"), VIK_LAYER_WIDGET_CHECKBUTTON }, + { "stop_length", VIK_LAYER_PARAM_UINT, GROUP_TRACKS, N_("Min Stop Length (seconds):"), VIK_LAYER_WIDGET_SPINBUTTON, params_scales + 8 }, + + { "line_thickness", VIK_LAYER_PARAM_UINT, GROUP_TRACKS, N_("Track Thickness:"), VIK_LAYER_WIDGET_SPINBUTTON, params_scales + 0 }, + { "bg_line_thickness", VIK_LAYER_PARAM_UINT, GROUP_TRACKS, N_("Track BG Thickness:"), VIK_LAYER_WIDGET_SPINBUTTON, params_scales + 6 }, + { "trackbgcolor", VIK_LAYER_PARAM_COLOR, GROUP_TRACKS, N_("Track Background Color"), VIK_LAYER_WIDGET_COLOR, 0 }, + { "velocity_min", VIK_LAYER_PARAM_DOUBLE, GROUP_TRACKS, N_("Min Track Velocity:"), VIK_LAYER_WIDGET_SPINBUTTON, params_scales + 1 }, + { "velocity_max", VIK_LAYER_PARAM_DOUBLE, GROUP_TRACKS, N_("Max Track Velocity:"), VIK_LAYER_WIDGET_SPINBUTTON, params_scales + 2 }, + + { "drawlabels", VIK_LAYER_PARAM_BOOLEAN, GROUP_WAYPOINTS, N_("Draw Labels"), VIK_LAYER_WIDGET_CHECKBUTTON }, + { "wpcolor", VIK_LAYER_PARAM_COLOR, GROUP_WAYPOINTS, N_("Waypoint Color:"), VIK_LAYER_WIDGET_COLOR, 0 }, + { "wptextcolor", VIK_LAYER_PARAM_COLOR, GROUP_WAYPOINTS, N_("Waypoint Text:"), VIK_LAYER_WIDGET_COLOR, 0 }, + { "wpbgcolor", VIK_LAYER_PARAM_COLOR, GROUP_WAYPOINTS, N_("Background:"), VIK_LAYER_WIDGET_COLOR, 0 }, + { "wpbgand", VIK_LAYER_PARAM_BOOLEAN, GROUP_WAYPOINTS, N_("Fake BG Color Translucency:"), VIK_LAYER_WIDGET_CHECKBUTTON, 0 }, + { "wpsymbol", VIK_LAYER_PARAM_UINT, GROUP_WAYPOINTS, N_("Waypoint marker:"), VIK_LAYER_WIDGET_RADIOGROUP, NULL }, + { "wpsize", VIK_LAYER_PARAM_UINT, GROUP_WAYPOINTS, N_("Waypoint size:"), VIK_LAYER_WIDGET_SPINBUTTON, params_scales + 7 }, + { "wpsyms", VIK_LAYER_PARAM_BOOLEAN, GROUP_WAYPOINTS, N_("Draw Waypoint Symbols:"), VIK_LAYER_WIDGET_CHECKBUTTON }, + + { "drawimages", VIK_LAYER_PARAM_BOOLEAN, GROUP_IMAGES, N_("Draw Waypoint Images"), VIK_LAYER_WIDGET_CHECKBUTTON }, + { "image_size", VIK_LAYER_PARAM_UINT, GROUP_IMAGES, N_("Image Size (pixels):"), VIK_LAYER_WIDGET_HSCALE, params_scales + 3 }, + { "image_alpha", VIK_LAYER_PARAM_UINT, GROUP_IMAGES, N_("Image Alpha:"), VIK_LAYER_WIDGET_HSCALE, params_scales + 4 }, + { "image_cache_size", VIK_LAYER_PARAM_UINT, GROUP_IMAGES, N_("Image Memory Cache Size:"), VIK_LAYER_WIDGET_HSCALE, params_scales + 5 }, }; enum { PARAM_TV, PARAM_WV, PARAM_DM, PARAM_DL, PARAM_DP, PARAM_DE, PARAM_EF, PARAM_DS, PARAM_SL, PARAM_LT, PARAM_BLT, PARAM_TBGC, PARAM_VMIN, PARAM_VMAX, PARAM_DLA, PARAM_WPC, PARAM_WPTC, PARAM_WPBC, PARAM_WPBA, PARAM_WPSYM, PARAM_WPSIZE, PARAM_WPSYMS, PARAM_DI, PARAM_IS, PARAM_IA, PARAM_ICS, NUM_PARAMS }; @@ -1332,9 +1333,9 @@ void vik_trw_layer_realize ( VikTrwLayer *vtl, VikTreeview *vt, GtkTreeIter *lay gpointer pass_along[5] = { &(vtl->tracks_iter), &iter2, vtl, vt, (gpointer) VIK_TRW_LAYER_SUBLAYER_TRACK }; #ifdef VIK_CONFIG_ALPHABETIZED_TRW - vik_treeview_add_sublayer_alphabetized ( (VikTreeview *) vt, layer_iter, &(vtl->tracks_iter), "Tracks", vtl, NULL, VIK_TRW_LAYER_SUBLAYER_TRACKS, NULL, TRUE, FALSE ); + vik_treeview_add_sublayer_alphabetized ( (VikTreeview *) vt, layer_iter, &(vtl->tracks_iter), _("Tracks"), vtl, NULL, VIK_TRW_LAYER_SUBLAYER_TRACKS, NULL, TRUE, FALSE ); #else - vik_treeview_add_sublayer ( (VikTreeview *) vt, layer_iter, &(vtl->tracks_iter), "Tracks", vtl, NULL, VIK_TRW_LAYER_SUBLAYER_TRACKS, NULL, TRUE, FALSE ); + vik_treeview_add_sublayer ( (VikTreeview *) vt, layer_iter, &(vtl->tracks_iter), _("Tracks"), vtl, NULL, VIK_TRW_LAYER_SUBLAYER_TRACKS, NULL, TRUE, FALSE ); #endif if ( ! vtl->tracks_visible ) vik_treeview_item_set_visible ( (VikTreeview *) vt, &(vtl->tracks_iter), FALSE ); @@ -1342,9 +1343,9 @@ void vik_trw_layer_realize ( VikTrwLayer *vtl, VikTreeview *vt, GtkTreeIter *lay g_hash_table_foreach ( vtl->tracks, (GHFunc) trw_layer_realize_track, pass_along ); #ifdef VIK_CONFIG_ALPHABETIZED_TRW - vik_treeview_add_sublayer_alphabetized ( (VikTreeview *) vt, layer_iter, &(vtl->waypoints_iter), "Waypoints", vtl, NULL, VIK_TRW_LAYER_SUBLAYER_WAYPOINTS, NULL, TRUE, FALSE ); + vik_treeview_add_sublayer_alphabetized ( (VikTreeview *) vt, layer_iter, &(vtl->waypoints_iter), _("Waypoints"), vtl, NULL, VIK_TRW_LAYER_SUBLAYER_WAYPOINTS, NULL, TRUE, FALSE ); #else - vik_treeview_add_sublayer ( (VikTreeview *) vt, layer_iter, &(vtl->waypoints_iter), "Waypoints", vtl, NULL, VIK_TRW_LAYER_SUBLAYER_WAYPOINTS, NULL, TRUE, FALSE ); + vik_treeview_add_sublayer ( (VikTreeview *) vt, layer_iter, &(vtl->waypoints_iter), _("Waypoints"), vtl, NULL, VIK_TRW_LAYER_SUBLAYER_WAYPOINTS, NULL, TRUE, FALSE ); #endif if ( ! vtl->waypoints_visible ) @@ -1450,7 +1451,7 @@ static void trw_layer_centerize ( gpointer layer_and_vlp[2] ) if ( vik_trw_layer_find_center ( VIK_TRW_LAYER(layer_and_vlp[0]), &coord ) ) goto_coord ( VIK_LAYERS_PANEL(layer_and_vlp[1]), &coord ); else - a_dialog_info_msg ( VIK_GTK_WINDOW_FROM_LAYER(layer_and_vlp[0]), "This layer has no waypoints or trackpoints." ); + a_dialog_info_msg ( VIK_GTK_WINDOW_FROM_LAYER(layer_and_vlp[0]), _("This layer has no waypoints or trackpoints.") ); } static void trw_layer_export ( gpointer layer_and_vlp[2], guint file_type ) @@ -1458,7 +1459,7 @@ static void trw_layer_export ( gpointer layer_and_vlp[2], guint file_type ) GtkWidget *file_selector; const gchar *fn; gboolean failed = FALSE; - file_selector = gtk_file_selection_new ("Export Layer"); + file_selector = gtk_file_selection_new (_("Export Layer")); gtk_file_selection_set_filename (GTK_FILE_SELECTION(file_selector), vik_layer_get_name(VIK_LAYER(layer_and_vlp[0]))); while ( gtk_dialog_run ( GTK_DIALOG(file_selector) ) == GTK_RESPONSE_OK ) @@ -1472,7 +1473,7 @@ static void trw_layer_export ( gpointer layer_and_vlp[2], guint file_type ) } else { - if ( a_dialog_overwrite ( VIK_GTK_WINDOW_FROM_LAYER(layer_and_vlp[0]), "The file \"%s\" exists, do you wish to overwrite it?", a_file_basename ( fn ) ) ) + if ( a_dialog_overwrite ( VIK_GTK_WINDOW_FROM_LAYER(layer_and_vlp[0]), _("The file \"%s\" exists, do you wish to overwrite it?"), a_file_basename ( fn ) ) ) { gtk_widget_hide ( file_selector ); failed = ! a_file_export ( VIK_TRW_LAYER(layer_and_vlp[0]), fn, file_type ); @@ -1482,7 +1483,7 @@ static void trw_layer_export ( gpointer layer_and_vlp[2], guint file_type ) } gtk_widget_destroy ( file_selector ); if ( failed ) - a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_LAYER(layer_and_vlp[0]), "The filename you requested could not be opened for writing." ); + a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_LAYER(layer_and_vlp[0]), _("The filename you requested could not be opened for writing.") ); } static void trw_layer_export_gpspoint ( gpointer layer_and_vlp[2] ) @@ -1503,7 +1504,7 @@ static void trw_layer_export_gpx ( gpointer layer_and_vlp[2] ) static void trw_layer_goto_wp ( gpointer layer_and_vlp[2] ) { GHashTable *wps = vik_trw_layer_get_waypoints ( VIK_TRW_LAYER(layer_and_vlp[0]) ); - GtkWidget *dia = gtk_dialog_new_with_buttons ("Create", + GtkWidget *dia = gtk_dialog_new_with_buttons (_("Create"), VIK_GTK_WINDOW_FROM_LAYER(layer_and_vlp[0]), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, @@ -1513,7 +1514,7 @@ static void trw_layer_goto_wp ( gpointer layer_and_vlp[2] ) NULL); GtkWidget *label, *entry; - label = gtk_label_new("Waypoint Name:"); + label = gtk_label_new(_("Waypoint Name:")); entry = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dia)->vbox), label, FALSE, FALSE, 0); @@ -1533,7 +1534,7 @@ static void trw_layer_goto_wp ( gpointer layer_and_vlp[2] ) wp = g_hash_table_lookup ( wps, upname ); if (!wp) - a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_LAYER(layer_and_vlp[0]), "Waypoint not found in this layer." ); + a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_LAYER(layer_and_vlp[0]), _("Waypoint not found in this layer.") ); else { vik_viewport_set_center_coord ( vik_layers_panel_get_viewport(VIK_LAYERS_PANEL(layer_and_vlp[1])), &(wp->coord) ); @@ -1587,44 +1588,44 @@ void vik_trw_layer_add_menu_items ( VikTrwLayer *vtl, GtkMenu *menu, gpointer vl gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Goto Center of Layer" ); + item = gtk_menu_item_new_with_label ( _("Goto Center of Layer") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_centerize), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Goto Waypoint" ); + item = gtk_menu_item_new_with_label ( _("Goto Waypoint") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_goto_wp), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); export_submenu = gtk_menu_new (); - item = gtk_menu_item_new_with_label ( "Export layer" ); + item = gtk_menu_item_new_with_label ( _("Export layer") ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), export_submenu ); - item = gtk_menu_item_new_with_label ( "Export as GPSPoint" ); + item = gtk_menu_item_new_with_label ( _("Export as GPSPoint") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_export_gpspoint), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (export_submenu), item); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Export as GPSMapper" ); + item = gtk_menu_item_new_with_label ( _("Export as GPSMapper") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_export_gpsmapper), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (export_submenu), item); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Export as GPX" ); + item = gtk_menu_item_new_with_label ( _("Export as GPX") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_export_gpx), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (export_submenu), item); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "New Waypoint" ); + item = gtk_menu_item_new_with_label ( _("New Waypoint") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_new_wp), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); #ifdef VIK_CONFIG_OPENSTREETMAP - item = gtk_menu_item_new_with_label ( "Upload to OSM" ); + item = gtk_menu_item_new_with_label ( _("Upload to OSM") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(osm_traces_upload_cb), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); @@ -2088,8 +2089,8 @@ static void trw_layer_merge_by_timestamp ( gpointer pass_along[6] ) gchar *orig_track_name = strdup(pass_along[3]); if (!a_dialog_time_threshold(VIK_GTK_WINDOW_FROM_LAYER(pass_along[0]), - "Merge Threshold...", - "Merge when time between trackpoints less than:", + _("Merge Threshold..."), + _("Merge when time between trackpoints less than:"), &thr)) { return; } @@ -2182,8 +2183,8 @@ static void trw_layer_split_by_timestamp ( gpointer pass_along[6] ) return; if (!a_dialog_time_threshold(VIK_GTK_WINDOW_FROM_LAYER(pass_along[0]), - "Split Threshold...", - "Split when time between trackpoints exceeds:", + _("Split Threshold..."), + _("Split when time between trackpoints exceeds:"), &thr)) { return; } @@ -2266,7 +2267,7 @@ const gchar *vik_trw_layer_sublayer_rename_request ( VikTrwLayer *l, const gchar if ( uppercase_exists_in_hash ( l->waypoints, newname ) ) { - a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_LAYER(l), "Waypoint Already Exists" ); + a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_LAYER(l), _("Waypoint Already Exists") ); return NULL; } @@ -2306,7 +2307,7 @@ const gchar *vik_trw_layer_sublayer_rename_request ( VikTrwLayer *l, const gchar if ( uppercase_exists_in_hash ( l->tracks, newname ) ) { - a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_LAYER(l), "Track Already Exists" ); + a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_LAYER(l), _("Track Already Exists") ); return NULL; } @@ -2429,7 +2430,7 @@ gboolean vik_trw_layer_sublayer_add_menu_items ( VikTrwLayer *l, GtkMenu *menu, { /* could be a right-click using the tool */ if ( vlp != NULL ) { - item = gtk_menu_item_new_with_label ( "Goto" ); + item = gtk_menu_item_new_with_label ( _("Goto") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_goto_waypoint), pass_along ); gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); @@ -2437,7 +2438,7 @@ gboolean vik_trw_layer_sublayer_add_menu_items ( VikTrwLayer *l, GtkMenu *menu, if ( is_valid_geocache_name ( (gchar *) sublayer ) ) { - item = gtk_menu_item_new_with_label ( "Visit Geocache Webpage" ); + item = gtk_menu_item_new_with_label ( _("Visit Geocache Webpage") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_waypoint_gc_webpage), pass_along ); gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); @@ -2452,37 +2453,37 @@ gboolean vik_trw_layer_sublayer_add_menu_items ( VikTrwLayer *l, GtkMenu *menu, gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Goto Startpoint" ); + item = gtk_menu_item_new_with_label ( _("Goto Startpoint") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_goto_track_startpoint), pass_along ); gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Goto \"Center\"" ); + item = gtk_menu_item_new_with_label ( _("Goto \"Center\"") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_goto_track_center), pass_along ); gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Goto Endpoint" ); + item = gtk_menu_item_new_with_label ( _("Goto Endpoint") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_goto_track_endpoint), pass_along ); gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Merge By Time" ); + item = gtk_menu_item_new_with_label ( _("Merge By Time") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_merge_by_timestamp), pass_along ); gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Split By Time" ); + item = gtk_menu_item_new_with_label ( _("Split By Time") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_split_by_timestamp), pass_along ); gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Download maps along track..." ); + item = gtk_menu_item_new_with_label ( _("Download maps along track...") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_download_map_along_track_cb), pass_along ); gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "Apply DEM Data" ); + item = gtk_menu_item_new_with_label ( _("Apply DEM Data") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_apply_dem_data), pass_along ); gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); @@ -2493,7 +2494,7 @@ gboolean vik_trw_layer_sublayer_add_menu_items ( VikTrwLayer *l, GtkMenu *menu, gtk_widget_show ( item ); #ifdef VIK_CONFIG_OPENSTREETMAP - item = gtk_menu_item_new_with_label ( "Upload to OSM" ); + item = gtk_menu_item_new_with_label ( _("Upload to OSM") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(osm_traces_upload_track_cb), pass_along ); gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); @@ -2527,7 +2528,7 @@ gboolean vik_trw_layer_sublayer_add_menu_items ( VikTrwLayer *l, GtkMenu *menu, gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); - item = gtk_menu_item_new_with_label ( "New Waypoint" ); + item = gtk_menu_item_new_with_label ( _("New Waypoint") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_new_wp), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); @@ -3463,7 +3464,7 @@ static gboolean tool_show_picture_click ( VikTrwLayer *vtl, GdkEventButton *even g_free ( quoted_file ); if ( ! g_spawn_command_line_async ( cmd, &err ) ) { - a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_LAYER(vtl), "Could not launch eog to open file." ); + a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_LAYER(vtl), _("Could not launch eog to open file.") ); g_error_free ( err ); } g_free ( cmd ); @@ -3517,7 +3518,7 @@ static void trw_layer_verify_thumbnails ( VikTrwLayer *vtl, GtkWidget *vp ) if ( pics ) { gint len = g_slist_length ( pics ); - gchar *tmp = g_strdup_printf ( "Creating %d Image Thumbnails...", len ); + gchar *tmp = g_strdup_printf ( _("Creating %d Image Thumbnails..."), len ); a_background_thread ( VIK_GTK_WINDOW_FROM_LAYER(vtl), tmp, (vik_thr_func) create_thumbnails_thread, pics, (vik_thr_free_func) free_pics_slist, NULL, len ); g_free ( tmp ); } @@ -3737,7 +3738,7 @@ static void trw_layer_download_map_along_track_cb(gpointer pass_along[6]) int num_maps = g_list_length(vmls); if (!num_maps) { - a_dialog_msg(VIK_GTK_WINDOW_FROM_LAYER(vtl), GTK_MESSAGE_ERROR,"No map layer in use. Create one first", NULL); + a_dialog_msg(VIK_GTK_WINDOW_FROM_LAYER(vtl), GTK_MESSAGE_ERROR, _("No map layer in use. Create one first"), NULL); return; } diff --git a/src/viktrwlayer_propwin.c b/src/viktrwlayer_propwin.c index 66b1ba48..8757acb3 100644 --- a/src/viktrwlayer_propwin.c +++ b/src/viktrwlayer_propwin.c @@ -19,8 +19,14 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include + #include +#include #include #include #include "coords.h" @@ -592,7 +598,7 @@ void vik_trw_layer_propwin_run ( GtkWindow *parent, VikTrwLayer *vtl, VikTrack * widgets->tr = tr; widgets->vlp = vlp; widgets->track_name = track_name; - gchar *title = g_strdup_printf("%s - Track Properties", track_name); + gchar *title = g_strdup_printf(_("%s - Track Properties"), track_name); GtkWidget *dialog = gtk_dialog_new_with_buttons (title, parent, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, @@ -618,7 +624,7 @@ void vik_trw_layer_propwin_run ( GtkWindow *parent, VikTrwLayer *vtl, VikTrack * int cnt; int i; - static gchar *label_texts[] = { "Comment:", "Track Length:", "Trackpoints:", "Segments:", "Duplicate Points:", "Max Speed:", "Avg. Speed:", "Avg. Dist. Between TPs:", "Elevation Range:", "Total Elevation Gain/Loss:", "Start:", "End:", "Duration:", "Track Distance/Time:" }; + static gchar *label_texts[] = { N_("Comment:"), N_("Track Length:"), N_("Trackpoints:"), N_("Segments:"), N_("Duplicate Points:"), N_("Max Speed:"), N_("Avg. Speed:"), N_("Avg. Dist. Between TPs:"), N_("Elevation Range:"), N_("Total Elevation Gain/Loss:"), N_("Start:"), N_("End:"), N_("Duration:"), N_("Track Distance/Time:") }; static gchar tmp_buf[50]; gdouble tmp_speed; @@ -646,14 +652,14 @@ void vik_trw_layer_propwin_run ( GtkWindow *parent, VikTrwLayer *vtl, VikTrack * tmp_speed = vik_track_get_max_speed(tr); if ( tmp_speed == 0 ) - g_snprintf(tmp_buf, sizeof(tmp_buf), "No Data"); + g_snprintf(tmp_buf, sizeof(tmp_buf), _("No Data")); else g_snprintf(tmp_buf, sizeof(tmp_buf), "%.2f m/s (%.0f km/h)", tmp_speed, MTOK(tmp_speed) ); widgets->w_max_speed = content[cnt++] = gtk_label_new ( tmp_buf ); tmp_speed = vik_track_get_average_speed(tr); if ( tmp_speed == 0 ) - g_snprintf(tmp_buf, sizeof(tmp_buf), "No Data"); + g_snprintf(tmp_buf, sizeof(tmp_buf), _("No Data")); else g_snprintf(tmp_buf, sizeof(tmp_buf), "%.2f m/s (%.0f km/h)", tmp_speed, MTOK(tmp_speed) ); widgets->w_avg_speed = content[cnt++] = gtk_label_new ( tmp_buf ); @@ -662,14 +668,14 @@ void vik_trw_layer_propwin_run ( GtkWindow *parent, VikTrwLayer *vtl, VikTrack * widgets->w_avg_dist = content[cnt++] = gtk_label_new ( tmp_buf ); if ( min_alt == VIK_DEFAULT_ALTITUDE ) - g_snprintf(tmp_buf, sizeof(tmp_buf), "No Data"); + g_snprintf(tmp_buf, sizeof(tmp_buf), _("No Data")); else g_snprintf(tmp_buf, sizeof(tmp_buf), "%.0f m - %.0f m", min_alt, max_alt ); widgets->w_elev_range = content[cnt++] = gtk_label_new ( tmp_buf ); vik_track_get_total_elevation_gain(tr, &max_alt, &min_alt ); if ( min_alt == VIK_DEFAULT_ALTITUDE ) - g_snprintf(tmp_buf, sizeof(tmp_buf), "No Data"); + g_snprintf(tmp_buf, sizeof(tmp_buf), _("No Data")); else g_snprintf(tmp_buf, sizeof(tmp_buf), "%.0f m / %.0f m", max_alt, min_alt ); widgets->w_elev_gain = content[cnt++] = gtk_label_new ( tmp_buf ); @@ -705,14 +711,14 @@ void vik_trw_layer_propwin_run ( GtkWindow *parent, VikTrwLayer *vtl, VikTrack * g_strchomp(tmp_buf); widgets->w_time_end = content[cnt++] = gtk_label_new(tmp_buf); - g_snprintf(tmp_buf, sizeof(tmp_buf), "%d minutes", (int)(t2-t1)/60); + g_snprintf(tmp_buf, sizeof(tmp_buf), _("%d minutes"), (int)(t2-t1)/60); widgets->w_time_dur = content[cnt++] = gtk_label_new(tmp_buf); } else { - widgets->w_time_start = content[cnt++] = gtk_label_new("No Data"); - widgets->w_time_end = content[cnt++] = gtk_label_new("No Data"); - widgets->w_time_dur = content[cnt++] = gtk_label_new("No Data"); + widgets->w_time_start = content[cnt++] = gtk_label_new(_("No Data")); + widgets->w_time_end = content[cnt++] = gtk_label_new(_("No Data")); + widgets->w_time_dur = content[cnt++] = gtk_label_new(_("No Data")); } - widgets->w_dist_time = content[cnt++] = gtk_label_new("No Data"); + widgets->w_dist_time = content[cnt++] = gtk_label_new(_("No Data")); table = GTK_TABLE(gtk_table_new (cnt, 2, FALSE)); gtk_table_set_col_spacing (table, 0, 10); @@ -721,7 +727,7 @@ void vik_trw_layer_propwin_run ( GtkWindow *parent, VikTrwLayer *vtl, VikTrack * label = gtk_label_new(NULL); gtk_misc_set_alignment ( GTK_MISC(label), 1, 0 ); - gtk_label_set_markup ( GTK_LABEL(label), label_texts[i] ); + gtk_label_set_markup ( GTK_LABEL(label), _(label_texts[i]) ); gtk_table_attach_defaults ( table, label, 0, 1, i, i+1 ); if (GTK_IS_MISC(content[i])) { gtk_misc_set_alignment ( GTK_MISC(content[i]), 0, 0 ); @@ -732,10 +738,10 @@ void vik_trw_layer_propwin_run ( GtkWindow *parent, VikTrwLayer *vtl, VikTrack * gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), GTK_WIDGET(table), FALSE, FALSE, 0); if ( profile ) - gtk_notebook_append_page(GTK_NOTEBOOK(graphs), profile, gtk_label_new("Elevation-distance")); + gtk_notebook_append_page(GTK_NOTEBOOK(graphs), profile, gtk_label_new(_("Elevation-distance"))); if ( vtdiag ) - gtk_notebook_append_page(GTK_NOTEBOOK(graphs), vtdiag, gtk_label_new("Speed-time")); + gtk_notebook_append_page(GTK_NOTEBOOK(graphs), vtdiag, gtk_label_new(_("Speed-time"))); gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), graphs, FALSE, FALSE, 0); diff --git a/src/viktrwlayer_tpwin.c b/src/viktrwlayer_tpwin.c index 40cf095a..4fea3877 100644 --- a/src/viktrwlayer_tpwin.c +++ b/src/viktrwlayer_tpwin.c @@ -19,7 +19,12 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include +#include #include #include "coords.h" @@ -93,10 +98,15 @@ static void tpwin_sync_alt_to_tp ( VikTrwLayerTpwin *tpwin ) VikTrwLayerTpwin *vik_trw_layer_tpwin_new ( GtkWindow *parent ) { - static gchar *left_label_texts[] = { "Part of Track:", "Latitude:", - "Longitude:", "Altitude:", "Timestamp:", "Time:" }; - static gchar *right_label_texts[] = { "Distance Difference:", - "Time Difference:", "\"Speed\" Between:" }; + static gchar *left_label_texts[] = { N_("Part of Track:"), + N_("Latitude:"), + N_("Longitude:"), + N_("Altitude:"), + N_("Timestamp:"), + N_("Time:") }; + static gchar *right_label_texts[] = { N_("Distance Difference:"), + N_("Time Difference:"), + N_("\"Speed\" Between:") }; VikTrwLayerTpwin *tpwin = VIK_TRW_LAYER_TPWIN ( g_object_new ( VIK_TRW_LAYER_TPWIN_TYPE, NULL ) ); GtkWidget *main_hbox, *left_vbox, *right_vbox; @@ -104,13 +114,13 @@ VikTrwLayerTpwin *vik_trw_layer_tpwin_new ( GtkWindow *parent ) gtk_window_set_transient_for ( GTK_WINDOW(tpwin), parent ); - gtk_window_set_title ( GTK_WINDOW(tpwin), "Trackpoint" ); + gtk_window_set_title ( GTK_WINDOW(tpwin), _("Trackpoint") ); gtk_dialog_add_buttons ( GTK_DIALOG(tpwin), GTK_STOCK_CLOSE, VIK_TRW_LAYER_TPWIN_CLOSE, GTK_STOCK_DELETE, VIK_TRW_LAYER_TPWIN_DELETE, - "Split Here", VIK_TRW_LAYER_TPWIN_SPLIT, - "Join With Last", VIK_TRW_LAYER_TPWIN_JOIN, + _("Split Here"), VIK_TRW_LAYER_TPWIN_SPLIT, + _("Join With Last"), VIK_TRW_LAYER_TPWIN_JOIN, GTK_STOCK_GO_BACK, VIK_TRW_LAYER_TPWIN_BACK, GTK_STOCK_GO_FORWARD, VIK_TRW_LAYER_TPWIN_FORWARD, NULL ); diff --git a/src/vikwindow.c b/src/vikwindow.c index b032f3e2..012fda63 100644 --- a/src/vikwindow.c +++ b/src/vikwindow.c @@ -18,6 +18,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "viking.h" #include "background.h" #include "acquire.h" @@ -26,14 +31,12 @@ #include "dems.h" #include "print.h" -#define VIKING_TITLE " - Viking" - -#include #include #include #include #include #include +#include #ifdef WINDOWS /* TODO IMPORTANT: mkdir for windows header? is it called 'mkdir' */ #define make_dir(dir) mkdir(dir) @@ -54,6 +57,7 @@ static GObjectClass *parent_class; static void window_init ( VikWindow *vw ); static void window_class_init ( VikWindowClass *klass ); +static void window_set_filename ( VikWindow *vw, const gchar *filename ); static void draw_update ( VikWindow *vw ); @@ -171,7 +175,7 @@ enum { static guint window_signals[VW_LAST_SIGNAL] = { 0 }; -static gchar *tool_names[NUMBER_OF_TOOLS] = { "Zoom", "Ruler", "Pan" }; +static gchar *tool_names[NUMBER_OF_TOOLS] = { N_("Zoom"), N_("Ruler"), N_("Pan") }; GdkCursor *vw_cursor_zoom = NULL; GdkCursor *vw_cursor_ruler = NULL; @@ -266,7 +270,7 @@ static void window_init ( VikWindow *vw ) vw->vt = toolbox_create(vw); window_create_ui(vw); - gtk_window_set_title ( GTK_WINDOW(vw), "Untitled" VIKING_TITLE ); + window_set_filename (vw, NULL); toolbox_activate(vw->vt, "Zoom"); @@ -349,9 +353,11 @@ static gboolean delete_event( VikWindow *vw ) { GtkDialog *dia; dia = GTK_DIALOG ( gtk_message_dialog_new ( GTK_WINDOW(vw), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, - "Do you want to save the changes you made to the document \"%s\"?\n\nYour changes will be lost if you don't save them.", - vw->filename ? a_file_basename ( vw->filename ) : "Untitled" ) ); - gtk_dialog_add_buttons ( dia, "Don't Save", GTK_RESPONSE_NO, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_YES, NULL ); + _("Do you want to save the changes you made to the document \"%s\"?\n" + "\n" + "Your changes will be lost if you don't save them."), + vw->filename ? a_file_basename ( vw->filename ) : _("Untitled") ) ); + gtk_dialog_add_buttons ( dia, _("Don't Save"), GTK_RESPONSE_NO, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_YES, NULL ); switch ( gtk_dialog_run ( dia ) ) { case GTK_RESPONSE_NO: gtk_widget_destroy ( GTK_WIDGET(dia) ); return FALSE; @@ -384,11 +390,11 @@ static void draw_sync ( VikWindow *vw ) static void draw_status ( VikWindow *vw ) { static gchar zoom_level[22]; - g_snprintf ( zoom_level, 22, "%.3f/%.3f %s", vik_viewport_get_xmpp (vw->viking_vvp), vik_viewport_get_ympp(vw->viking_vvp), vik_viewport_get_coord_mode(vw->viking_vvp) == VIK_COORD_UTM ? "mpp" : "pixelfact" ); + g_snprintf ( zoom_level, 22, "%.3f/%.3f %s", vik_viewport_get_xmpp (vw->viking_vvp), vik_viewport_get_ympp(vw->viking_vvp), vik_viewport_get_coord_mode(vw->viking_vvp) == VIK_COORD_UTM ? _("mpp") : _("pixelfact") ); if ( vw->current_tool == TOOL_LAYER ) vik_statusbar_set_message ( vw->viking_vs, 0, vik_layer_get_interface(vw->tool_layer_id)->tools[vw->tool_tool_id].name ); else - vik_statusbar_set_message ( vw->viking_vs, 0, tool_names[vw->current_tool] ); + vik_statusbar_set_message ( vw->viking_vs, 0, _(tool_names[vw->current_tool]) ); vik_statusbar_set_message ( vw->viking_vs, 2, zoom_level ); } @@ -486,9 +492,9 @@ static void draw_mouse_motion (VikWindow *vw, GdkEventMotion *event) else interpol_method = VIK_DEM_INTERPOL_BEST; if ((alt = a_dems_get_elev_by_coord(&coord, interpol_method)) != VIK_DEM_INVALID_ELEVATION) - g_snprintf ( pointer_buf, 36, "Cursor: %f %f %dm", ll.lat, ll.lon, alt ); + g_snprintf ( pointer_buf, 36, _("Cursor: %f %f %dm"), ll.lat, ll.lon, alt ); else - g_snprintf ( pointer_buf, 36, "Cursor: %f %f", ll.lat, ll.lon ); + g_snprintf ( pointer_buf, 36, _("Cursor: %f %f"), ll.lat, ll.lon ); vik_statusbar_set_message ( vw->viking_vs, 4, pointer_buf ); if ( vw->pan_x != -1 ) { @@ -1003,7 +1009,7 @@ static void menu_paste_layer_cb ( GtkAction *a, VikWindow *vw ) static void menu_properties_cb ( GtkAction *a, VikWindow *vw ) { if ( ! vik_layers_panel_properties ( vw->viking_vlp ) ) - a_dialog_info_msg ( GTK_WINDOW(vw), "You must select a layer to show its properties." ); + a_dialog_info_msg ( GTK_WINDOW(vw), _("You must select a layer to show its properties.") ); } static void help_about_cb ( GtkAction *a, VikWindow *vw ) @@ -1019,7 +1025,7 @@ static void menu_delete_layer_cb ( GtkAction *a, VikWindow *vw ) vw->modified = TRUE; } else - a_dialog_info_msg ( GTK_WINDOW(vw), "You must select a layer to delete." ); + a_dialog_info_msg ( GTK_WINDOW(vw), _("You must select a layer to delete.") ); } /*************************************** @@ -1164,20 +1170,22 @@ static void menu_tool_cb ( GtkAction *old, GtkAction *a, VikWindow *vw ) static void window_set_filename ( VikWindow *vw, const gchar *filename ) { gchar *title; + const gchar *file; if ( vw->filename ) g_free ( vw->filename ); if ( filename == NULL ) { vw->filename = NULL; - gtk_window_set_title ( GTK_WINDOW(vw), "Untitled" VIKING_TITLE ); + file = _("Untitled"); } else { vw->filename = g_strdup(filename); - title = g_strconcat ( a_file_basename ( filename ), VIKING_TITLE, NULL ); - gtk_window_set_title ( GTK_WINDOW(vw), title ); - g_free ( title ); + file = a_file_basename ( filename ); } + title = g_strdup_printf( "%s - Viking", file ); + gtk_window_set_title ( GTK_WINDOW(vw), title ); + g_free ( title ); } GtkWidget *vik_window_get_drawmode_button ( VikWindow *vw, VikViewportDrawMode mode ) @@ -1201,7 +1209,7 @@ void vik_window_open_file ( VikWindow *vw, const gchar *filename, gboolean chang switch ( a_file_load ( vik_layers_panel_get_top_layer(vw->viking_vlp), vw->viking_vvp, filename ) ) { case 0: - a_dialog_error_msg ( GTK_WINDOW(vw), "The file you requested could not be opened." ); + a_dialog_error_msg ( GTK_WINDOW(vw), _("The file you requested could not be opened.") ); break; case 1: { @@ -1242,7 +1250,7 @@ static void load_file ( GtkAction *a, VikWindow *vw ) if ( ! vw->open_dia ) { - vw->open_dia = gtk_file_selection_new ("Please select a GPS data file to open. " ); + vw->open_dia = gtk_file_selection_new ( _("Please select a GPS data file to open. ") ); gtk_file_selection_set_select_multiple ( GTK_FILE_SELECTION(vw->open_dia), TRUE ); gtk_window_set_transient_for ( GTK_WINDOW(vw->open_dia), GTK_WINDOW(vw) ); gtk_window_set_destroy_with_parent ( GTK_WINDOW(vw->open_dia), TRUE ); @@ -1275,7 +1283,7 @@ static gboolean save_file_as ( GtkAction *a, VikWindow *vw ) const gchar *fn; if ( ! vw->save_dia ) { - vw->save_dia = gtk_file_selection_new ("Save as Viking File. " ); + vw->save_dia = gtk_file_selection_new ( _("Save as Viking File.") ); gtk_window_set_transient_for ( GTK_WINDOW(vw->save_dia), GTK_WINDOW(vw) ); gtk_window_set_destroy_with_parent ( GTK_WINDOW(vw->save_dia), TRUE ); } @@ -1283,7 +1291,7 @@ static gboolean save_file_as ( GtkAction *a, VikWindow *vw ) while ( gtk_dialog_run ( GTK_DIALOG(vw->save_dia) ) == GTK_RESPONSE_OK ) { fn = gtk_file_selection_get_filename (GTK_FILE_SELECTION(vw->save_dia) ); - if ( access ( fn, F_OK ) != 0 || a_dialog_overwrite ( GTK_WINDOW(vw->save_dia), "The file \"%s\" exists, do you wish to overwrite it?", a_file_basename ( fn ) ) ) + if ( access ( fn, F_OK ) != 0 || a_dialog_overwrite ( GTK_WINDOW(vw->save_dia), _("The file \"%s\" exists, do you wish to overwrite it?"), a_file_basename ( fn ) ) ) { window_set_filename ( vw, fn ); rv = window_save ( vw ); @@ -1301,7 +1309,7 @@ static gboolean window_save ( VikWindow *vw ) return TRUE; else { - a_dialog_error_msg ( GTK_WINDOW(vw), "The filename you requested could not be opened for writing." ); + a_dialog_error_msg ( GTK_WINDOW(vw), _("The filename you requested could not be opened for writing.") ); return FALSE; } } @@ -1493,7 +1501,7 @@ static void draw_to_image_file_current_window_cb(GtkWidget* widget,GdkEventButto height = vik_viewport_get_height ( vw->viking_vvp ) * vik_viewport_get_xmpp ( vw->viking_vvp ) / gtk_spin_button_get_value ( zoom_spin ); if ( width > width_max || width < width_min || height > height_max || height < height_min ) - a_dialog_info_msg ( GTK_WINDOW(vw), "Viewable region outside allowable pixel size bounds for image. Clipping width/height values." ); + a_dialog_info_msg ( GTK_WINDOW(vw), _("Viewable region outside allowable pixel size bounds for image. Clipping width/height values.") ); gtk_spin_button_set_value ( width_spin, width ); gtk_spin_button_set_value ( height_spin, height ); @@ -1512,7 +1520,7 @@ static void draw_to_image_file_total_area_cb (GtkSpinButton *spinbutton, gpointe w *= gtk_spin_button_get_value(GTK_SPIN_BUTTON(pass_along[4])); h *= gtk_spin_button_get_value(GTK_SPIN_BUTTON(pass_along[5])); } - label_text = g_strdup_printf ( "Total area: %ldm x %ldm (%.3f sq. km)", (glong)w, (glong)h, (w*h/1000000)); + label_text = g_strdup_printf ( _("Total area: %ldm x %ldm (%.3f sq. km)"), (glong)w, (glong)h, (w*h/1000000)); gtk_label_set_text(GTK_LABEL(pass_along[6]), label_text); g_free ( label_text ); } @@ -1520,7 +1528,7 @@ static void draw_to_image_file_total_area_cb (GtkSpinButton *spinbutton, gpointe static void draw_to_image_file ( VikWindow *vw, const gchar *fn, gboolean one_image_only ) { /* todo: default for answers inside VikWindow or static (thruout instance) */ - GtkWidget *dialog = gtk_dialog_new_with_buttons ( "Save to Image File", GTK_WINDOW(vw), + GtkWidget *dialog = gtk_dialog_new_with_buttons ( _("Save to Image File"), GTK_WINDOW(vw), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, @@ -1538,18 +1546,18 @@ static void draw_to_image_file ( VikWindow *vw, const gchar *fn, gboolean one_im GtkWidget *tiles_width_spin = NULL, *tiles_height_spin = NULL; - width_label = gtk_label_new ( "Width (pixels):" ); + width_label = gtk_label_new ( _("Width (pixels):") ); width_spin = gtk_spin_button_new ( GTK_ADJUSTMENT(gtk_adjustment_new ( vw->draw_image_width, 10, 5000, 10, 100, 0 )), 10, 0 ); - height_label = gtk_label_new ( "Height (pixels):" ); + height_label = gtk_label_new ( _("Height (pixels):") ); height_spin = gtk_spin_button_new ( GTK_ADJUSTMENT(gtk_adjustment_new ( vw->draw_image_height, 10, 5000, 10, 100, 0 )), 10, 0 ); - zoom_label = gtk_label_new ( "Zoom (meters per pixel):" ); + zoom_label = gtk_label_new ( _("Zoom (meters per pixel):") ); /* TODO: separate xzoom and yzoom factors */ zoom_spin = gtk_spin_button_new ( GTK_ADJUSTMENT(gtk_adjustment_new ( vik_viewport_get_xmpp(vw->viking_vvp), VIK_VIEWPORT_MIN_ZOOM, VIK_VIEWPORT_MAX_ZOOM/2.0, 1, 100, 3 )), 16, 3); total_size_label = gtk_label_new ( NULL ); - current_window_button = gtk_button_new_with_label ( "Area in current viewable window" ); + current_window_button = gtk_button_new_with_label ( _("Area in current viewable window") ); current_window_pass_along [0] = vw; current_window_pass_along [1] = width_spin; current_window_pass_along [2] = height_spin; @@ -1559,8 +1567,8 @@ static void draw_to_image_file ( VikWindow *vw, const gchar *fn, gboolean one_im current_window_pass_along [6] = total_size_label; g_signal_connect ( G_OBJECT(current_window_button), "button_press_event", G_CALLBACK(draw_to_image_file_current_window_cb), current_window_pass_along ); - png_radio = gtk_radio_button_new_with_label ( NULL, "Save as PNG" ); - jpeg_radio = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON(png_radio), "Save as JPEG" ); + png_radio = gtk_radio_button_new_with_label ( NULL, _("Save as PNG") ); + jpeg_radio = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON(png_radio), _("Save as JPEG") ); if ( ! vw->draw_image_save_as_png ) gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(jpeg_radio), TRUE ); @@ -1580,9 +1588,9 @@ static void draw_to_image_file ( VikWindow *vw, const gchar *fn, gboolean one_im GtkWidget *tiles_width_label, *tiles_height_label; - tiles_width_label = gtk_label_new ( "East-west image tiles:" ); + tiles_width_label = gtk_label_new ( _("East-west image tiles:") ); tiles_width_spin = gtk_spin_button_new ( GTK_ADJUSTMENT(gtk_adjustment_new ( 5, 1, 10, 1, 100, 0 )), 1, 0 ); - tiles_height_label = gtk_label_new ( "North-south image tiles:" ); + tiles_height_label = gtk_label_new ( _("North-south image tiles:") ); tiles_height_spin = gtk_spin_button_new ( GTK_ADJUSTMENT(gtk_adjustment_new ( 5, 1, 10, 1, 100, 0 )), 1, 0 ); gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), tiles_width_label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), tiles_width_spin, FALSE, FALSE, 0); @@ -1622,7 +1630,7 @@ static void draw_to_image_file ( VikWindow *vw, const gchar *fn, gboolean one_im gtk_spin_button_get_value ( GTK_SPIN_BUTTON(tiles_width_spin) ), gtk_spin_button_get_value ( GTK_SPIN_BUTTON(tiles_height_spin) ) ); else - a_dialog_error_msg ( GTK_WINDOW(vw), "You must be in UTM mode to use this feature" ); + a_dialog_error_msg ( GTK_WINDOW(vw), _("You must be in UTM mode to use this feature") ); } } gtk_widget_destroy ( GTK_WIDGET(dialog) ); @@ -1633,7 +1641,7 @@ static void draw_to_image_file_cb ( GtkAction *a, VikWindow *vw ) { const gchar *fn; if (!vw->save_img_dia) { - vw->save_img_dia = gtk_file_selection_new ("Save Image"); + vw->save_img_dia = gtk_file_selection_new ( _("Save Image") ); gtk_window_set_transient_for ( GTK_WINDOW(vw->save_img_dia), GTK_WINDOW(vw) ); gtk_window_set_destroy_with_parent ( GTK_WINDOW(vw->save_img_dia), TRUE ); } @@ -1641,7 +1649,7 @@ static void draw_to_image_file_cb ( GtkAction *a, VikWindow *vw ) while ( gtk_dialog_run ( GTK_DIALOG(vw->save_img_dia) ) == GTK_RESPONSE_OK ) { fn = gtk_file_selection_get_filename (GTK_FILE_SELECTION(vw->save_img_dia) ); - if ( access ( fn, F_OK ) != 0 || a_dialog_overwrite ( GTK_WINDOW(vw->save_img_dia), "The file \"%s\" exists, do you wish to overwrite it?", a_file_basename ( fn ) ) ) + if ( access ( fn, F_OK ) != 0 || a_dialog_overwrite ( GTK_WINDOW(vw->save_img_dia), _("The file \"%s\" exists, do you wish to overwrite it?"), a_file_basename ( fn ) ) ) { draw_to_image_file ( vw, fn, TRUE ); break; @@ -1654,7 +1662,7 @@ static void draw_to_image_dir_cb ( GtkAction *a, VikWindow *vw ) { const gchar *fn; if (!vw->save_img_dir_dia) { - vw->save_img_dir_dia = gtk_file_selection_new ("Choose a name for a new directory to hold images"); + vw->save_img_dir_dia = gtk_file_selection_new ( _("Choose a name for a new directory to hold images")); gtk_window_set_transient_for ( GTK_WINDOW(vw->save_img_dir_dia), GTK_WINDOW(vw) ); gtk_window_set_destroy_with_parent ( GTK_WINDOW(vw->save_img_dir_dia), TRUE ); } @@ -1663,7 +1671,7 @@ static void draw_to_image_dir_cb ( GtkAction *a, VikWindow *vw ) { fn = gtk_file_selection_get_filename (GTK_FILE_SELECTION(vw->save_img_dir_dia) ); if ( access ( fn, F_OK ) == 0 ) - a_dialog_info_msg_extra ( GTK_WINDOW(vw->save_img_dir_dia), "The file %s exists. Please choose a name for a new directory to hold images in that does not exist.", a_file_basename(fn) ); + a_dialog_info_msg_extra ( GTK_WINDOW(vw->save_img_dir_dia), _("The file %s exists. Please choose a name for a new directory to hold images in that does not exist."), a_file_basename(fn) ); else { draw_to_image_file ( vw, fn, FALSE ); @@ -1741,7 +1749,7 @@ static void set_draw_centermark ( GtkAction *a, VikWindow *vw ) static void set_bg_color ( GtkAction *a, VikWindow *vw ) { - GtkWidget *colorsd = gtk_color_selection_dialog_new ("Choose a background color"); + GtkWidget *colorsd = gtk_color_selection_dialog_new ( _("Choose a background color") ); GdkColor *color = vik_viewport_get_background_gdkcolor ( vw->viking_vvp ); gtk_color_selection_set_previous_color ( GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(colorsd)->colorsel), color ); gtk_color_selection_set_current_color ( GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(colorsd)->colorsel), color ); @@ -1901,7 +1909,7 @@ static void window_create_ui( VikWindow *window ) action.name = vik_layer_get_interface(i)->name; action.stock_id = vik_layer_get_interface(i)->name; - action.label = g_strdup_printf("New %s Layer", vik_layer_get_interface(i)->name); + action.label = g_strdup_printf( _("New %s Layer"), vik_layer_get_interface(i)->name); action.accelerator = NULL; action.tooltip = NULL; action.callback = (GCallback)menu_addlayer_cb; @@ -1918,11 +1926,11 @@ static void window_create_ui( VikWindow *window ) ntools++; gtk_ui_manager_add_ui(uim, mid, "/ui/MainMenu/Tools", - vik_layer_get_interface(i)->tools[j].name, + _(vik_layer_get_interface(i)->tools[j].name), vik_layer_get_interface(i)->tools[j].name, GTK_UI_MANAGER_MENUITEM, FALSE); gtk_ui_manager_add_ui(uim, mid, "/ui/MainToolbar/ToolItems", - vik_layer_get_interface(i)->tools[j].name, + _(vik_layer_get_interface(i)->tools[j].name), vik_layer_get_interface(i)->tools[j].name, GTK_UI_MANAGER_TOOLITEM, FALSE); @@ -1930,9 +1938,9 @@ static void window_create_ui( VikWindow *window ) radio->name = vik_layer_get_interface(i)->tools[j].name; radio->stock_id = vik_layer_get_interface(i)->tools[j].name, - radio->label = vik_layer_get_interface(i)->tools[j].name; + radio->label = _(vik_layer_get_interface(i)->tools[j].name); radio->accelerator = NULL; - radio->tooltip = vik_layer_get_interface(i)->tools[j].name; + radio->tooltip = _(vik_layer_get_interface(i)->tools[j].name); radio->value = ntools; } } -- 2.39.5