From 07f6bf899c98422344f196dc081448336d27c842 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 20 Nov 2017 10:59:50 -0500 Subject: MqApplication: Internationalize --- (limited to 'src') diff --git a/src/application.c b/src/application.c index 2155937..d29d308 100644 --- a/src/application.c +++ b/src/application.c @@ -33,6 +33,7 @@ #include "config/config.h" #include "config/profiles.h" #include "download.h" +#include "i18n.h" #include "schemes/about.h" #include "schemes/view-source.h" #include "window.h" @@ -142,9 +143,11 @@ quit_confirm_response_cb(GtkWidget *dialog, gint response_id) void mq_application_quit(MqApplication *application, GtkWindow *parent) { - guint num_windows; - guint num_tabs; + guint wins; + guint tabs; GList *item; + gchar *msg_tabs; + gchar *msg_wins; gchar *message; GtkWidget *message_label; GtkWidget *check_button; @@ -152,14 +155,14 @@ mq_application_quit(MqApplication *application, GtkWindow *parent) GtkWidget *hbox; GtkWidget *dialog; - num_windows = 0; - num_tabs = 0; + wins = 0; + tabs = 0; for (item = application->windows; item; item = item->next) { - ++num_windows; - num_tabs += mq_window_get_num_tabs(item->data); + ++wins; + tabs += mq_window_get_num_tabs(item->data); } - if (num_tabs == 1) { /* Also implies num_windows == 1 */ + if (tabs == 1) { /* Also implies wins == 1 */ gtk_main_quit(); return; /* Making sure... */ } @@ -170,21 +173,19 @@ mq_application_quit(MqApplication *application, GtkWindow *parent) } /* Message */ - if (num_windows == 1) { - message = g_strdup_printf("You are about to close %d tabs " - "in %d window. Are you sure you want to continue?", - num_tabs, num_windows); - } else { - message = g_strdup_printf("You are about to close %d tabs " - "in %d windows. Are you sure you want to continue?", - num_tabs, num_windows); - } + msg_tabs = g_strdup_printf(PL_("%d tab", "%d tabs", tabs), tabs); + msg_wins = g_strdup_printf(PL_("%d window", "%d windows", wins), wins); + message = g_strdup_printf(_("You are about to close %s in %s. " + "Are you sure you want to continue?"), + msg_tabs, msg_wins); + g_free(msg_tabs); + g_free(msg_wins); message_label = gtk_label_new(message); g_free(message); /* Check button */ check_button = gtk_check_button_new_with_mnemonic( - "_Warn When Closing Multiple Tabs or Windows"); + _("_Warn When Closing Multiple Tabs or Windows")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button), mq_config_get_boolean(application->config, "tabs.warn-on-close")); @@ -207,10 +208,10 @@ mq_application_quit(MqApplication *application, GtkWindow *parent) gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); /* Dialog */ - dialog = gtk_dialog_new_with_buttons("Confirm Close", parent, + dialog = gtk_dialog_new_with_buttons(_("Confirm Close"), parent, GTK_DIALOG_DESTROY_WITH_PARENT, - "_Cancel", GTK_RESPONSE_CANCEL, - "Cl_ose Tabs", GTK_RESPONSE_OK, + _("_Cancel"), GTK_RESPONSE_CANCEL, + _("Cl_ose Tabs"), GTK_RESPONSE_OK, NULL); gtk_container_add( GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), -- cgit v0.9.1