From 59a94f4366fe3099bb602abc88d61e0151b87bc5 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 21 Nov 2019 22:23:10 +0100 Subject: [PATCH] Make a bunch of strings translatable --- xfburn/xfburn-audio-composition.c | 12 +++++++----- xfburn/xfburn-blank-dialog.c | 2 +- .../xfburn-burn-data-composition-base-dialog.c | 2 +- xfburn/xfburn-data-composition.c | 16 +++++++++------- xfburn/xfburn-main-window.c | 14 +++++++------- xfburn/xfburn-main.c | 16 ++++++++-------- xfburn/xfburn-preferences-dialog.c | 2 +- xfburn/xfburn-progress-dialog.c | 4 ++-- xfburn/xfburn-transcoder-basic.c | 2 +- xfburn/xfburn-transcoder-gst.c | 14 +++++++------- xfburn/xfburn-transcoder.c | 4 ++-- xfburn/xfburn-udev-manager.c | 2 +- xfburn/xfburn-utils.c | 2 +- 13 files changed, 48 insertions(+), 44 deletions(-) diff --git a/xfburn/xfburn-audio-composition.c b/xfburn/xfburn-audio-composition.c index 3530d98..23e3757 100644 --- a/xfburn/xfburn-audio-composition.c +++ b/xfburn/xfburn-audio-composition.c @@ -292,6 +292,8 @@ xfburn_audio_composition_init (XfburnAudioComposition * composition) GdkScreen *screen; GtkIconTheme *icon_theme; +// TODO: This string should be exported as .ui file +// Otherwise the label text may not be included in the translations #if 0 /* CDTEXT */ const gchar ui_string[] = " " "" "" "" ""; @@ -299,7 +301,7 @@ xfburn_audio_composition_init (XfburnAudioComposition * composition) // const gchar ui_string[] = " " ""; const gchar ui_string[] = "" "
" - "Removewin.remove-file" + "Removewin.remove-file" "
" "
"; #endif /* CDTEXT */ @@ -363,20 +365,20 @@ xfburn_audio_composition_init (XfburnAudioComposition * composition) gtk_widget_insert_action_group (priv->toolbar, "win", G_ACTION_GROUP (priv->action_group)); xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbar), - "list-add", "Add", "win.add-file", _("Add the selected file(s) to the composition")); + "list-add", _("Add"), "win.add-file", _("Add the selected file(s) to the composition")); gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), gtk_separator_tool_item_new(), -1); xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbar), - "list-remove", "Remove", "win.remove-file", _("Remove the selected file(s) from the composition")); + "list-remove", _("Remove"), "win.remove-file", _("Remove the selected file(s) from the composition")); xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbar), - "edit-clear", "Clear", "win.clear", _("Clear the content of the composition")); + "edit-clear", _("Clear"), "win.clear", _("Clear the content of the composition")); gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), gtk_separator_tool_item_new(), -1); #ifdef HAVE_GST xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbar), - "help-about", "gstreamer", "win.transcoder-info", _("What files can get burned to an audio CD?")); + "help-about", _("gstreamer"), "win.transcoder-info", _("What files can get burned to an audio CD?")); #endif gtk_box_pack_start (GTK_BOX (hbox_toolbar), priv->toolbar, TRUE, TRUE, 0); gtk_widget_show_all (priv->toolbar); diff --git a/xfburn/xfburn-blank-dialog.c b/xfburn/xfburn-blank-dialog.c index ebdba60..b83a4e3 100644 --- a/xfburn/xfburn-blank-dialog.c +++ b/xfburn/xfburn-blank-dialog.c @@ -210,7 +210,7 @@ xfburn_blank_dialog_init (XfburnBlankDialog * obj) gtk_box_pack_start (GTK_BOX (vbox), priv->check_eject, FALSE, FALSE, BORDER); /* action buttons */ - button = gtk_button_new_with_mnemonic ("_Cancel"); + button = gtk_button_new_with_mnemonic (_("_Cancel")); gtk_widget_show (button); gtk_dialog_add_action_widget (GTK_DIALOG (obj), button, GTK_RESPONSE_CANCEL); diff --git a/xfburn/xfburn-burn-data-composition-base-dialog.c b/xfburn/xfburn-burn-data-composition-base-dialog.c index efadcf1..ec40486 100644 --- a/xfburn/xfburn-burn-data-composition-base-dialog.c +++ b/xfburn/xfburn-burn-data-composition-base-dialog.c @@ -251,7 +251,7 @@ xfburn_burn_data_composition_base_dialog_init(XfburnBurnDataCompositionBaseDialo g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (cb_browse_iso), obj); /* action buttons */ - button = gtk_button_new_with_mnemonic ("_Cancel"); + button = gtk_button_new_with_mnemonic (_("_Cancel")); gtk_widget_show (button); gtk_dialog_add_action_widget (GTK_DIALOG (obj), button, GTK_RESPONSE_CANCEL); diff --git a/xfburn/xfburn-data-composition.c b/xfburn/xfburn-data-composition.c index 42d84bd..ba4e25a 100644 --- a/xfburn/xfburn-data-composition.c +++ b/xfburn/xfburn-data-composition.c @@ -273,12 +273,14 @@ xfburn_data_composition_init (XfburnDataComposition * composition) GdkScreen *screen; GtkIconTheme *icon_theme; + // TODO: This string should be exported as .ui file + // Otherwise the label text may not be included in the translations const gchar ui_string[] = "" "
" - "win.create-dirCreate directory" + "win.create-dirCreate directory" "
" - "win.rename-fileRename" - "win.remove-fileRemove" + "win.rename-fileRename" + "win.remove-fileRemove" "
"; GtkTargetEntry gte_src[] = { { "XFBURN_TREE_PATHS", GTK_TARGET_SAME_WIDGET, DATA_COMPOSITION_DND_TARGET_INSIDE } }; @@ -336,16 +338,16 @@ xfburn_data_composition_init (XfburnDataComposition * composition) gtk_widget_insert_action_group (priv->toolbar, "win", G_ACTION_GROUP (priv->action_group)); xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbar), - "list-add", "Add", "win.add-file", _("Add the selected file(s) to the composition")); + "list-add", _("Add"), "win.add-file", _("Add the selected file(s) to the composition")); xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbar), - "folder-new", "Create directory", "win.create-dir", _("Add a new directory to the composition")); + "folder-new", _("Create directory"), "win.create-dir", _("Add a new directory to the composition")); gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), gtk_separator_tool_item_new(), -1); xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbar), - "list-remove", "Remove", "win.remove-file", _("Remove the selected file(s) from the composition")); + "list-remove", _("Remove"), "win.remove-file", _("Remove the selected file(s) from the composition")); xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbar), - "edit-clear", "Clear", "win.clear", _("Clear the content of the composition")); + "edit-clear", _("Clear"), "win.clear", _("Clear the content of the composition")); gtk_box_pack_start (GTK_BOX (hbox_toolbar), priv->toolbar, TRUE, TRUE, 0); gtk_widget_show_all (priv->toolbar); diff --git a/xfburn/xfburn-main-window.c b/xfburn/xfburn-main-window.c index 05871f3..f53ec85 100644 --- a/xfburn/xfburn-main-window.c +++ b/xfburn/xfburn-main-window.c @@ -307,23 +307,23 @@ xfburn_main_window_init (XfburnMainWindow * mainwin) gtk_widget_insert_action_group (priv->toolbars, "app", G_ACTION_GROUP (priv->action_map)); xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbars), - "stock_xfburn-new-data-composition", "New data composition", "app.new-data-composition", NULL); + "stock_xfburn-new-data-composition", _("New data composition"), "app.new-data-composition", NULL); xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbars), - "stock_xfburn-audio-cd", "New audio composition", "app.new-audio-composition", NULL); + "stock_xfburn-audio-cd", _("New audio composition"), "app.new-audio-composition", NULL); gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbars), gtk_separator_tool_item_new(), -1); - xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbars), - "stock_xfburn-blank-cdrw", "Blank CD-RW", "app.blank-disc", NULL); - xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbars), - "stock_xfburn", "Burn Image", "app.burn-image", NULL); + "stock_xfburn-blank-cdrw", _("Blank CD-RW"), "app.blank-disc", NULL); + + xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbars), + "stock_xfburn", _("Burn Image"), "app.burn-image", NULL); gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbars), gtk_separator_tool_item_new(), -1); xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbars), - "view-refresh", "Refresh", "app.refresh", "Refresh file list"); + "view-refresh", _("Refresh"), "app.refresh", _("Refresh file list")); gtk_box_pack_start (GTK_BOX (vbox), priv->toolbars, FALSE, FALSE, 5); gtk_toolbar_set_icon_size(GTK_TOOLBAR (priv->toolbars), GTK_ICON_SIZE_SMALL_TOOLBAR); diff --git a/xfburn/xfburn-main.c b/xfburn/xfburn-main.c index 47369e6..69a3175 100644 --- a/xfburn/xfburn-main.c +++ b/xfburn/xfburn-main.c @@ -71,21 +71,21 @@ static gchar *initial_dir = NULL; static GOptionEntry optionentries[] = { { "burn-image", 'i', G_OPTION_FLAG_OPTIONAL_ARG /* || G_OPTION_FLAG_FILENAME */, G_OPTION_ARG_CALLBACK, &parse_option, - "Open the burn image dialog, optionally followed by the image filename", NULL }, + N_("Open the burn image dialog, optionally followed by the image filename"), NULL }, { "blank", 'b', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, &parse_option, - "Open the blank disc dialog", NULL }, + N_("Open the blank disc dialog"), NULL }, { "data-composition", 'd', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, &parse_option, - "Start a data composition, optionally followed by files/directories to be added to the composition", NULL }, + N_("Start a data composition, optionally followed by files/directories to be added to the composition"), NULL }, { "audio-composition", 'a', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, &parse_option, - "Start an audio composition, optionally followed by files/directories to be added to the composition", NULL }, + N_("Start an audio composition, optionally followed by files/directories to be added to the composition"), NULL }, { "transcoder", 't', 0, G_OPTION_ARG_STRING, &transcoder_selection, - "Select the transcoder, run with --transcoder=list to see the available ones", NULL }, + N_("Select the transcoder, run with --transcoder=list to see the available ones"), NULL }, { "directory", 'D', G_OPTION_FLAG_OPTIONAL_ARG , G_OPTION_ARG_CALLBACK, &parse_option, - "Start the file browser in the specified directory, or the current directory if none is specified (the default is to start in your home directory)", NULL }, + N_("Start the file browser in the specified directory, or the current directory if none is specified (the default is to start in your home directory)"), NULL }, { "version", 'V', 0 , G_OPTION_ARG_NONE, &show_version, - "Display program version and exit", NULL }, + N_("Display program version and exit"), NULL }, { "main", 'm', 0, G_OPTION_ARG_NONE, &show_main, - "Show main program even when other action is specified on the command line.", NULL }, + N_("Show main program even when other action is specified on the command line."), NULL }, { NULL, ' ', 0, 0, NULL, NULL, NULL } }; diff --git a/xfburn/xfburn-preferences-dialog.c b/xfburn/xfburn-preferences-dialog.c index 4ee77e7..1d46b9c 100644 --- a/xfburn/xfburn-preferences-dialog.c +++ b/xfburn/xfburn-preferences-dialog.c @@ -328,7 +328,7 @@ xfburn_preferences_dialog_init (XfburnPreferencesDialog * obj) gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - label = gtk_label_new("close"); + label = gtk_label_new_with_mnemonic (_("_Close")); gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); gtk_widget_show (hbox); diff --git a/xfburn/xfburn-progress-dialog.c b/xfburn/xfburn-progress-dialog.c index 71201e8..42907c6 100644 --- a/xfburn/xfburn-progress-dialog.c +++ b/xfburn/xfburn-progress-dialog.c @@ -165,7 +165,7 @@ xfburn_progress_dialog_init (XfburnProgressDialog * obj) gtk_window_set_default_size (GTK_WINDOW (obj), 575, 200); /* label */ - priv->label_action = gtk_label_new ("Initializing ..."); + priv->label_action = gtk_label_new (_("Initializing...")); gtk_label_set_xalign(GTK_LABEL (priv->label_action), 0.1); gtk_label_set_justify (GTK_LABEL (priv->label_action), GTK_JUSTIFY_LEFT); gtk_label_set_selectable (GTK_LABEL (priv->label_action), TRUE); @@ -224,7 +224,7 @@ xfburn_progress_dialog_init (XfburnProgressDialog * obj) g_signal_connect (G_OBJECT (priv->button_stop), "clicked", G_CALLBACK (cb_button_stop_clicked), obj); priv->button_close = gtk_button_new_from_icon_name ("gtk-close", GTK_ICON_SIZE_BUTTON); - gtk_button_set_label (GTK_BUTTON (priv->button_close), "Close"); + gtk_button_set_label (GTK_BUTTON (priv->button_close), _("Close")); gtk_widget_show (priv->button_close); gtk_dialog_add_action_widget (GTK_DIALOG (obj), priv->button_close, GTK_RESPONSE_CLOSE); gtk_widget_set_can_default (priv->button_close, TRUE); diff --git a/xfburn/xfburn-transcoder-basic.c b/xfburn/xfburn-transcoder-basic.c index dc49b6c..697a89b 100644 --- a/xfburn/xfburn-transcoder-basic.c +++ b/xfburn/xfburn-transcoder-basic.c @@ -66,7 +66,7 @@ enum { /* globals */ -static const gchar *errormsg_libburn_setup = "An error occurred while setting the burning backend up"; +static const gchar *errormsg_libburn_setup = N_("An error occurred while setting the burning backend up"); /*********************/ /* class declaration */ diff --git a/xfburn/xfburn-transcoder-gst.c b/xfburn/xfburn-transcoder-gst.c index 2a5fcd0..add8217 100644 --- a/xfburn/xfburn-transcoder-gst.c +++ b/xfburn/xfburn-transcoder-gst.c @@ -141,13 +141,13 @@ typedef struct { static guint64 total_size = 0; #endif -static const gchar *errormsg_gst_setup = "An error occurred setting gstreamer up for transcoding"; -static const gchar *errormsg_libburn_setup = "An error occurred while setting the burning backend up"; -static const gchar *errormsg_missing_plugin = "%s is missing.\n" +static const gchar *errormsg_gst_setup = N_("An error occurred setting gstreamer up for transcoding"); +static const gchar *errormsg_libburn_setup = N_("An error occurred while setting the burning backend up"); +static const gchar *errormsg_missing_plugin = N_("%s is missing.\n" "\n" "You do not have a decoder installed to handle this file.\n" "Probably you need to look at the gst-plugins-* packages\n" - "for the necessary plugins.\n"; + "for the necessary plugins.\n"); /*********************/ /* class declaration */ @@ -539,7 +539,7 @@ on_pad_added (GstElement *element, GstPad *pad, gpointer data) GstMessage *msg; GstBus *bus; - gchar *error_msg = "File content has a decoder but is not audio."; + const gchar *error_msg = N_("File content has a decoder but is not audio."); DBG ("%s", error_msg); @@ -624,9 +624,9 @@ get_discoverer_required_plugins_message (GstDiscovererInfo *info) plugins = (gchar **) gst_discoverer_info_get_missing_elements_installer_details (info); if (g_strv_length(plugins) == 0) { - str = g_string_new ("No information available on which plugin is required."); + str = g_string_new (_("No information available on which plugin is required.")); } else { - str = g_string_new("Required plugins: "); + str = g_string_new (_("Required plugins: ")); plugins_str = g_strjoinv (", ", plugins); g_string_append (str, plugins_str); g_free (plugins_str); diff --git a/xfburn/xfburn-transcoder.c b/xfburn/xfburn-transcoder.c index 64a721e..9c43fb6 100644 --- a/xfburn/xfburn-transcoder.c +++ b/xfburn/xfburn-transcoder.c @@ -100,7 +100,7 @@ xfburn_transcoder_get_name (XfburnTranscoder *trans) if (iface->get_name) return iface->get_name (trans); else - return "none"; + return _("none"); } const gchar * @@ -110,7 +110,7 @@ xfburn_transcoder_get_description (XfburnTranscoder *trans) if (iface->get_description) return iface->get_description (trans); else - return "none"; + return _("none"); } gboolean diff --git a/xfburn/xfburn-udev-manager.c b/xfburn/xfburn-udev-manager.c index 5fba06f..0d84b3e 100644 --- a/xfburn/xfburn-udev-manager.c +++ b/xfburn/xfburn-udev-manager.c @@ -486,7 +486,7 @@ xfburn_udev_manager_check_ask_umount (XfburnUdevManager *udevman, XfburnDevice * if (unmounted) g_message ("Unmounted '%s'", mp); else { - xfce_dialog_show_error (NULL, NULL, "Failed to unmount '%s'. Drive cannot be used for burning.", mp); + xfce_dialog_show_error (NULL, NULL, _("Failed to unmount '%s'. Drive cannot be used for burning."), mp); DBG ("Failed to unmount '%s'", mp); } diff --git a/xfburn/xfburn-utils.c b/xfburn/xfburn-utils.c index 629ce31..7854ce5 100644 --- a/xfburn/xfburn-utils.c +++ b/xfburn/xfburn-utils.c @@ -128,7 +128,7 @@ xfburn_browse_for_file (GtkEntry *entry, GtkWindow *parent) text = gtk_entry_get_text (entry); - dialog = gtk_file_chooser_dialog_new (_("Select command"), parent, GTK_FILE_CHOOSER_ACTION_SAVE, "_Cancel", + dialog = gtk_file_chooser_dialog_new (_("Select command"), parent, GTK_FILE_CHOOSER_ACTION_SAVE, _("_Cancel"), GTK_RESPONSE_CANCEL, "document-save", GTK_RESPONSE_ACCEPT, NULL); if(xfburn_main_has_initial_dir ()) { -- 2.24.0