# # # patch "AdvancedFind.pm" # from [9ecb0053b5bb0b7e821572fa740b04a014c9dbc8] # to [3aeb29a81f3a8fc5109fc65a2cafa3e2f5a14e8e] # # patch "Annotate.pm" # from [a7ea5986f0e39d4cf61ae584d78506669d7b99ed] # to [39d40e1faf8febd71ec9d2d5a312a8f92652d55b] # # patch "ChangeLog.pm" # from [a87b32ed216e2953730f2408f305b1ee80481a67] # to [96644abd5e5d421ade30b5badfee1d807e2e9c17] # # patch "ComboAutoCompletion.pm" # from [d07d96a4ba4b54a3eb15d93d7ff3d0deb64342ee] # to [2c0b4573d0d7f5ae6f51e8f58cc80fdc3b61325c] # # patch "FindText.pm" # from [c617752847f5c43e194ac5ef24ab91ab85d1cc8d] # to [e4ca03bc7058a6740a963c5dfdb66a899ebdc034] # # patch "History.pm" # from [0a0f559ca522cea54e20bdcbf6eccbaf983bb936] # to [25ce79927ae07595a6702679f27f96f41f372237] # # patch "Preferences.pm" # from [9582cfdd83a9f9ef8af46a0c1fc17a6d460119d4] # to [92527102b3ae36a4abeb1b5bd901bae0c03e1333] # # patch "Utilities.pm" # from [d4930c03d430af5ac4a2d0dcf1cb3d7d5a898c27] # to [0162a0665b728ecb82a1b3e880b869e3e9788f19] # # patch "WindowManager.pm" # from [ac9adeeda684e518512e1adb1ca5bfd3a0287d2c] # to [8eb2da4972c53daad7f5a59ef5fe1f92e9b52833] # # patch "mtn-browse" # from [88920cff112f114139d36a0ba7cecbc14b305bca] # to [96fe56cb79dfe462e5d0fa65ef243ef5d3800f61] # ============================================================ --- AdvancedFind.pm 9ecb0053b5bb0b7e821572fa740b04a014c9dbc8 +++ AdvancedFind.pm 3aeb29a81f3a8fc5109fc65a2cafa3e2f5a14e8e @@ -287,49 +287,49 @@ sub populate_button_clicked_cb($$) localtime($advanced_find->{date_dateedit}-> get_time())); $to_insert = ""; - if ($selector eq "Author") + if ($selector eq __("Author")) { - $to_insert = "a:" . (($arg eq "") ? "" : $arg); + $to_insert = "a:" . (($arg eq "") ? __("") : $arg); } - elsif ($selector eq "Branch") + elsif ($selector eq __("Branch")) { - $to_insert = "b:" . (($arg eq "") ? "" : $arg); + $to_insert = "b:" . (($arg eq "") ? __("") : $arg); } - elsif ($selector eq "Cert") + elsif ($selector eq __("Cert")) { - $to_insert = "c:" . (($arg eq "") ? "" : $arg); + $to_insert = "c:" . (($arg eq "") ? __("") : $arg); } - elsif ($selector eq "Date (=)") + elsif ($selector eq __("Date (=)")) { $to_insert = "d:" . $time_val; } - elsif ($selector eq "Date (<=)") + elsif ($selector eq __("Date (<=)")) { $to_insert = "e:" . $time_val; } - elsif ($selector eq "Date (>)") + elsif ($selector eq __("Date (>)")) { $to_insert = "l:" . $time_val; } - elsif ($selector eq "Head Revision") + elsif ($selector eq __("Head Revision")) { $to_insert = "h:"; } - elsif ($selector eq "Identifier") + elsif ($selector eq __("Identifier")) { - $to_insert = "i:" . (($arg eq "") ? "" : $arg); + $to_insert = "i:" . (($arg eq "") ? __("") : $arg); } - elsif ($selector eq "Parent") + elsif ($selector eq __("Parent")) { - $to_insert = "p:" . (($arg eq "") ? "" : $arg); + $to_insert = "p:" . (($arg eq "") ? __("") : $arg); } - elsif ($selector eq "Separator") + elsif ($selector eq __("Separator")) { $to_insert = "/"; } - elsif ($selector eq "Tag") + elsif ($selector eq __("Tag")) { - $to_insert = "t:" . (($arg eq "") ? "" : $arg); + $to_insert = "t:" . (($arg eq "") ? __("") : $arg); } $pos = @@ -382,7 +382,7 @@ sub term_combobox_changed_cb($$) $advanced_find->{argument_entry}->set_sensitive(FALSE); $advanced_find->{date_dateedit}->set_sensitive(TRUE); } - elsif ($selector eq "Head" || $selector eq "Separator") + elsif ($selector eq __("Head Revision") || $selector eq __("Separator")) { $advanced_find->{argument_entry}->set_sensitive(FALSE); $advanced_find->{date_dateedit}->set_sensitive(FALSE); @@ -614,7 +614,7 @@ sub get_advanced_find_window($) $instance->{revisions_treeview}-> set_model($instance->{revisions_liststore}); $tv_column = Gtk2::TreeViewColumn->new(); - $tv_column->set_title("Matching Revision Ids"); + $tv_column->set_title(__("Matching Revision Ids")); $tv_column->set_sort_column_id(0); $renderer = Gtk2::CellRendererText->new(); $tv_column->pack_start($renderer, FALSE); @@ -738,7 +738,7 @@ sub update_advanced_find_state($$) # Get the new list of branches. - $advanced_find->{appbar}->set_status("Fetching branch list"); + $advanced_find->{appbar}->set_status(__("Fetching branch list")); gtk2_update(); $advanced_find->{mtn}->branches(address@hidden) if (defined($advanced_find->{mtn})); @@ -746,7 +746,7 @@ sub update_advanced_find_state($$) # Update the branch list combobox. - $advanced_find->{appbar}->set_status("Populating branch list"); + $advanced_find->{appbar}->set_status(__("Populating branch list")); gtk2_update(); my $counter = 1; $advanced_find->{branch_comboboxentry}->get_model()->clear(); @@ -789,7 +789,7 @@ sub update_advanced_find_state($$) if ($advanced_find->{branch_combo_details}->{complete}) { - $advanced_find->{appbar}->set_status("Fetching revision list"); + $advanced_find->{appbar}->set_status(__("Fetching revision list")); gtk2_update(); get_branch_revisions($advanced_find->{mtn}, $advanced_find->{branch_combo_details}-> @@ -804,7 +804,7 @@ sub update_advanced_find_state($$) # Update the revision list combobox. $advanced_find->{appbar}->set_progress_percentage(0); - $advanced_find->{appbar}->set_status("Populating revision list"); + $advanced_find->{appbar}->set_status(__("Populating revision list")); gtk2_update(); my $counter = 1; $advanced_find->{revision_comboboxentry}->get_model()->clear(); @@ -838,7 +838,7 @@ sub update_advanced_find_state($$) # Get the list of matching revisions. - $advanced_find->{appbar}->set_status("Finding revisions"); + $advanced_find->{appbar}->set_status(__("Finding revisions")); gtk2_update(); if ($advanced_find->{simple_query_radiobutton}->get_active()) { @@ -867,9 +867,10 @@ sub update_advanced_find_state($$) ["modal"], "warning", "close", - sprintf("Problem with your query, Monotone " - . "gave:\n%s", - Glib::Markup::escape_text($message))); + __("Problem with your query, Monotone ") + . __x("gave:\n{error_message}", + error_message => + Glib::Markup::escape_text($message))); $dialog->run(); $dialog->destroy(); die("Bad query"); }); @@ -894,7 +895,7 @@ sub update_advanced_find_state($$) ["modal"], "info", "close", - "No revisions matched your query."); + __("No revisions matched your query.")); $dialog->run(); $dialog->destroy(); } @@ -930,7 +931,8 @@ sub update_advanced_find_state($$) # Update the revisions tree view. - $advanced_find->{appbar}->set_status("Populating revision details"); + $advanced_find->{appbar}-> + set_status(__("Populating revision details")); $counter = 1; foreach my $item (@revision_ids) { ============================================================ --- Annotate.pm a7ea5986f0e39d4cf61ae584d78506669d7b99ed +++ Annotate.pm 39d40e1faf8febd71ec9d2d5a312a8f92652d55b @@ -93,7 +93,8 @@ sub display_annotation($$$) $instance = get_annotation_window(); local $instance->{in_cb} = 1; - $instance->{window}->set_title("Annotated Listing Of " . $file_name); + $instance->{window}->set_title(__x("Annotated Listing Of {file}", + file => $file_name)); $instance->{window}->show_all(); $wm->make_busy($instance, 1); @@ -102,7 +103,7 @@ sub display_annotation($$$) # Get Monotone to do the annotation. - $instance->{appbar}->set_status("Annotating file"); + $instance->{appbar}->set_status(__("Annotating file")); gtk2_update(); mtn_annotate(address@hidden, $mtn->get_db_name(), $revision_id, $file_name); @@ -122,7 +123,7 @@ sub display_annotation($$$) # Display the result, highlighting according to the annotate output. $instance->{appbar}->set_status - ("Formatting and displaying annotated file"); + (__("Formatting and displaying annotated file")); gtk2_update(); $padding = " " x $max_len; $prefix_tag = $text_tag = ""; ============================================================ --- ChangeLog.pm a87b32ed216e2953730f2408f305b1ee80481a67 +++ ChangeLog.pm 96644abd5e5d421ade30b5badfee1d807e2e9c17 @@ -86,7 +86,8 @@ sub display_change_log($$;$$) $instance = get_change_log_window(); $instance->{changelog_buffer}->set_text(""); - $instance->{window}->set_title("Revision " . ($tag ? $tag : $revision_id)); + $instance->{window}->set_title(__x("Revision {rev}", + rev => ($tag ? $tag : $revision_id))); $mtn->certs(address@hidden, $revision_id); $mtn->get_revision(address@hidden, $revision_id); generate_revision_report($instance->{changelog_buffer}, ============================================================ --- ComboAutoCompletion.pm d07d96a4ba4b54a3eb15d93d7ff3d0deb64342ee +++ ComboAutoCompletion.pm 2c0b4573d0d7f5ae6f51e8f58cc80fdc3b61325c @@ -226,7 +226,9 @@ sub comboboxentry_key_release_event_cb($ else { $instance->{appbar}-> - push("Invalid " . $name . " name`" . $value . "'"); + push(__x("Invalid {name} name `{value}'", + name => $name, + value => $value)); } $value = $completion; $len = length($value); ============================================================ --- FindText.pm c617752847f5c43e194ac5ef24ab91ab85d1cc8d +++ FindText.pm e4ca03bc7058a6740a963c5dfdb66a899ebdc034 @@ -370,7 +370,8 @@ sub find_button_clicked_cb($$) ["modal"], "info", "close", - sprintf("Could not find\n`%s'.", $search_term)); + __x("Could not find\n`{search_term}'.", + search_term => $search_term)); $dialog->run(); $dialog->destroy(); } ============================================================ --- History.pm 0a0f559ca522cea54e20bdcbf6eccbaf983bb936 +++ History.pm 25ce79927ae07595a6702679f27f96f41f372237 @@ -106,8 +106,9 @@ sub display_revision_change_history($$) $instance->{file_name} = undef; $instance->{first_revision_id} = ""; $instance->{second_revision_id} = ""; - $instance->{window}->set_title("Revision History For " . $revision_id); - $instance->{history_label}->set_markup("Revision History"); + $instance->{window}->set_title(__x("Revision History For {rev}", + rev => $revision_id)); + $instance->{history_label}->set_markup(__("Revision History")); $instance->{window}->show_all(); $wm->make_busy($instance, 1); @@ -120,14 +121,14 @@ sub display_revision_change_history($$) # revision in the history. $instance->{appbar}->set_progress_percentage(0); - $instance->{appbar}->set_status("Fetching revision list"); + $instance->{appbar}->set_status(__("Fetching revision list")); gtk2_update(); $history_hash{$revision_id} = 1; get_revision_history_helper($instance, \%history_hash, $revision_id); # Sort the list. - $instance->{appbar}->set_status("Sorting revision list"); + $instance->{appbar}->set_status(__("Sorting revision list")); gtk2_update(); $instance->{history} = []; $instance->{mtn}->toposort($instance->{history}, keys(%history_hash)); @@ -137,7 +138,7 @@ sub display_revision_change_history($$) # Display the file's history. $instance->{appbar}->set_progress_percentage(0); - $instance->{appbar}->set_status("Displaying revision history"); + $instance->{appbar}->set_status(__("Displaying revision history")); gtk2_update(); $counter = 1; $instance->{stop} = 0; @@ -157,15 +158,15 @@ sub display_revision_change_history($$) # Add the buttons. - $button = Gtk2::Button->new("Select As Id 1"); + $button = Gtk2::Button->new(__("Select As Id 1")); $button->signal_connect("clicked", \&history_list_button_clicked_cb, {instance => $instance, revision_id => $revision_id, button_type => "1"}); $tooltips->set_tip($button, - "Select this revision for comparison\n" - . "as the first revision"); + __("Select this revision for comparison\n") + . __("as the first revision")); $instance->{history_textview}->add_child_at_anchor ($button, $instance->{history_buffer}-> @@ -175,15 +176,15 @@ sub display_revision_change_history($$) $instance->{history_buffer}-> insert($instance->{history_buffer}->get_end_iter(), " "); - $button = Gtk2::Button->new("Select As Id 2"); + $button = Gtk2::Button->new(__("Select As Id 2")); $button->signal_connect("clicked", \&history_list_button_clicked_cb, {instance => $instance, revision_id => $revision_id, button_type => "2"}); $tooltips->set_tip($button, - "Select this revision for comparison\n" - . "as the second revision"); + __("Select this revision for comparison\n") + . __("as the second revision")); $instance->{history_textview}->add_child_at_anchor ($button, $instance->{history_buffer}-> @@ -193,14 +194,14 @@ sub display_revision_change_history($$) $instance->{history_buffer}-> insert($instance->{history_buffer}->get_end_iter(), " "); - $button = Gtk2::Button->new("Browse Revision"); + $button = Gtk2::Button->new(__("Browse Revision")); $button->signal_connect("clicked", \&history_list_button_clicked_cb, {instance => $instance, revision_id => $revision_id, button_type => "browse-revision"}); $tooltips->set_tip($button, - "Browse the revision in\na new browser window"); + __("Browse the revision in\na new browser window")); $instance->{history_textview}->add_child_at_anchor ($button, $instance->{history_buffer}-> @@ -210,13 +211,13 @@ sub display_revision_change_history($$) $instance->{history_buffer}-> insert($instance->{history_buffer}->get_end_iter(), " "); - $button = Gtk2::Button->new("Full Change Log"); + $button = Gtk2::Button->new(__("Full Change Log")); $button->signal_connect("clicked", \&history_list_button_clicked_cb, {instance => $instance, revision_id => $revision_id, button_type => "revision-changelog"}); - $tooltips->set_tip($button, "View the revision's full change log"); + $tooltips->set_tip($button, __("View the revision's full change log")); $instance->{history_textview}->add_child_at_anchor ($button, $instance->{history_buffer}-> @@ -307,9 +308,9 @@ sub display_file_change_history($$$) $instance->{file_name} = $file_name; $instance->{first_revision_id} = ""; $instance->{second_revision_id} = ""; - $instance->{window}->set_title - ("File History For " . $instance->{file_name}); - $instance->{history_label}->set_markup("File History"); + $instance->{window}->set_title(__x("File History For {file}", + file=> $instance->{file_name})); + $instance->{history_label}->set_markup(__("File History")); $instance->{window}->show_all(); $wm->make_busy($instance, 1); @@ -321,7 +322,7 @@ sub display_file_change_history($$$) # temporarily disable the warning handler. $instance->{appbar}->set_progress_percentage(0); - $instance->{appbar}->set_status("Fetching revision list"); + $instance->{appbar}->set_status(__("Fetching revision list")); $instance->{stop_button}->set_sensitive(TRUE); gtk2_update(); Monotone::AutomateStdio->register_error_handler("warning"); @@ -332,7 +333,7 @@ sub display_file_change_history($$$) # Sort the list. - $instance->{appbar}->set_status("Sorting revision list"); + $instance->{appbar}->set_status(__("Sorting revision list")); gtk2_update(); $instance->{history} = []; $instance->{mtn}->toposort($instance->{history}, keys(%history_hash)); @@ -342,7 +343,7 @@ sub display_file_change_history($$$) # Display the file's history. $instance->{appbar}->set_progress_percentage(0); - $instance->{appbar}->set_status("Displaying file history"); + $instance->{appbar}->set_status(__("Displaying file history")); gtk2_update(); $counter = 1; $instance->{history_buffer}->set_text(""); @@ -361,15 +362,15 @@ sub display_file_change_history($$$) # Add the buttons. - $button = Gtk2::Button->new("Select As Id 1"); + $button = Gtk2::Button->new(__("Select As Id 1")); $button->signal_connect("clicked", \&history_list_button_clicked_cb, {instance => $instance, revision_id => $revision_id, button_type => "1"}); $tooltips->set_tip($button, - "Select this file revision for\n" - . "comparison as the first file"); + __("Select this file revision for\n") + . __("comparison as the first file")); $instance->{history_textview}->add_child_at_anchor ($button, $instance->{history_buffer}-> @@ -379,15 +380,15 @@ sub display_file_change_history($$$) $instance->{history_buffer}-> insert($instance->{history_buffer}->get_end_iter(), " "); - $button = Gtk2::Button->new("Select As Id 2"); + $button = Gtk2::Button->new(__("Select As Id 2")); $button->signal_connect("clicked", \&history_list_button_clicked_cb, {instance => $instance, revision_id => $revision_id, button_type => "2"}); $tooltips->set_tip($button, - "Select this file revision for\n" - . "comparison as the second file"); + __("Select this file revision for\n") + . __("comparison as the second file")); $instance->{history_textview}->add_child_at_anchor ($button, $instance->{history_buffer}-> @@ -397,14 +398,14 @@ sub display_file_change_history($$$) $instance->{history_buffer}-> insert($instance->{history_buffer}->get_end_iter(), " "); - $button = Gtk2::Button->new("Browse File"); + $button = Gtk2::Button->new(__("Browse File")); $button->signal_connect("clicked", \&history_list_button_clicked_cb, {instance => $instance, revision_id => $revision_id, button_type => "browse-file"}); $tooltips->set_tip($button, - "Browse the file in\na new browser window"); + __("Browse the file in\na new browser window")); $instance->{history_textview}->add_child_at_anchor ($button, $instance->{history_buffer}-> @@ -414,13 +415,13 @@ sub display_file_change_history($$$) $instance->{history_buffer}-> insert($instance->{history_buffer}->get_end_iter(), " "); - $button = Gtk2::Button->new("Full Change Log"); + $button = Gtk2::Button->new(__("Full Change Log")); $button->signal_connect("clicked", \&history_list_button_clicked_cb, {instance => $instance, revision_id => $revision_id, button_type => "revision-changelog"}); - $tooltips->set_tip($button, "View the revision's full change log"); + $tooltips->set_tip($button, __("View the revision's full change log")); $instance->{history_textview}->add_child_at_anchor ($button, $instance->{history_buffer}-> @@ -685,18 +686,19 @@ sub compare_revisions($$$;$) $instance = get_revision_comparison_window(); local $instance->{in_cb} = 1; - $instance->{window}->set_title("Differences Between Revisions " - . $revision_id_1 - . " And " - . $revision_id_2); + $instance->{window}-> + set_title(__x("Differences Between Revisions {rev_1} and {rev_2}", + rev_1 => $revision_id_1, + rev_2 => $revision_id_2)); if (defined($file_name)) { - $instance->{comparison_label}->set_markup("File Comparison"); + $instance->{comparison_label}-> + set_markup(__("File Comparison")); } else { $instance->{comparison_label}-> - set_markup("Revision Comparison"); + set_markup(__("Revision Comparison")); } $instance->{window}->show_all(); @@ -710,7 +712,7 @@ sub compare_revisions($$$;$) # Get Monotone to do the comparison. - $instance->{appbar}->set_status("Calculating differences"); + $instance->{appbar}->set_status(__("Calculating differences")); gtk2_update(); mtn_diff(address@hidden, $mtn->get_db_name(), @@ -733,7 +735,8 @@ sub compare_revisions($$$;$) # Display the result, highlighting according to the diff output. Remember # the first two lines are just empty comment lines. - $instance->{appbar}->set_status("Formatting and displaying differences"); + $instance->{appbar}-> + set_status(__("Formatting and displaying differences")); gtk2_update(); $padding = " " x $max_len; $line = substr(" Summary" . $padding, 0, $max_len); @@ -878,7 +881,7 @@ sub compare_revisions($$$;$) # Populate the file combobox. $instance->{appbar}->set_progress_percentage(0); - $instance->{appbar}->set_status("Populating file list"); + $instance->{appbar}->set_status(__("Populating file list")); gtk2_update(); @files = sort({ $a->{file_name} cmp $b->{file_name} } @files); $i = 1; @@ -1288,11 +1291,15 @@ sub get_revision_comparison_window() $instance->{revision_change_log_1_button_label}-> set_markup("Revision Change Log"); + . "'>" + . __("Revision Change Log") + . ""); $instance->{revision_change_log_2_button_label}-> set_markup("Revision Change Log"); + . "'>" + . __("Revision Change Log") + . ""); # Register the window for management. ============================================================ --- Preferences.pm 9582cfdd83a9f9ef8af46a0c1fc17a6d460119d4 +++ Preferences.pm 92527102b3ae36a4abeb1b5bd901bae0c03e1333 @@ -81,6 +81,39 @@ my @text_viewable_app_mime_types = x-troff xhtml+xml); +# A preferences sub-record mapping table, used for loading in and saving the +# colour preferences. + +my @colour_mapping_table = + ({widget => "annotation_prefix_1_foreground_colorbutton", + record => "annotate_prefix_1"}, + {widget => "annotation_prefix_1_background_colorbutton", + record => "annotate_prefix_1"}, + {widget => "annotation_text_1_foreground_colorbutton", + record => "annotate_text_1"}, + {widget => "annotation_text_1_background_colorbutton", + record => "annotate_text_1"}, + {widget => "annotation_prefix_2_foreground_colorbutton", + record => "annotate_prefix_2"}, + {widget => "annotation_prefix_2_background_colorbutton", + record => "annotate_prefix_2"}, + {widget => "annotation_text_2_foreground_colorbutton", + record => "annotate_text_2"}, + {widget => "annotation_text_2_background_colorbutton", + record => "annotate_text_2"}, + {widget => "revision_1_foreground_colorbutton", + record => "cmp_revision_1"}, + {widget => "revision_1_background_colorbutton", + record => "cmp_revision_1"}, + {widget => "revision_1_highlight_colorbutton", + record => "cmp_revision_1"}, + {widget => "revision_2_foreground_colorbutton", + record => "cmp_revision_2"}, + {widget => "revision_2_background_colorbutton", + record => "cmp_revision_2"}, + {widget => "revision_2_highlight_colorbutton", + record => "cmp_revision_2"}); + # ***** FUNCTIONAL PROTOTYPES FOR THIS FILE ***** # Public routines. @@ -145,7 +178,7 @@ sub preferences($) ["modal"], "warning", "close", - sprintf("The preferences dialog cannot be displayed:\n%s", $@)); + __("The preferences dialog cannot be displayed:\n") . $@); $dialog->run(); $dialog->destroy(); return; @@ -181,7 +214,7 @@ sub preferences($) ["modal"], "warning", "close", - sprintf("Your preferences could not be saved:\n%s", $@)); + __("Your preferences could not be saved:\n") . $@); $dialog->run(); $dialog->destroy(); return; @@ -227,23 +260,24 @@ sub load_preferences() # Either load in the preferences or initialise them from scratch depending # upon whether the preferences file exists or not. - if (-f $file_name && -r $file_name) + if (-f $file_name) { defined($prefs_file = IO::File->new($file_name, "r")) - or die("open failed: $!\n"); + or die(__x("open failed: {error_message}\n", error_message => $!)); eval(join("", $prefs_file->getlines())); - die("Invalid user preferences file: address@hidden") if ($@ ne ""); + die(__x("Invalid user preferences file: {error_message}\n", + error_message => $@)) + if ($@ ne ""); $prefs_file->close(); - die(sprintf("Preferences file, `%s',\n" - . "is at the wrong version, please remove it.\n", - $file_name)) + die(__x("Preferences file, `{file_name}',\n", file_name => $file_name) + . __("is at the wrong version, please remove it.\n")) if (! exists($preferences{version}) || $preferences{version} != PREFERENCES_FORMAT_VERSION); } else { defined($mime_table = initialise_mime_info_table()) - or die("Cannot load system MIME types.\n"); + or die(__("Cannot load system MIME types.\n")); %preferences = (version => PREFERENCES_FORMAT_VERSION, default_mtn_db => "", @@ -304,12 +338,12 @@ sub save_preferences($) # Write out the preferences record to disk. defined($prefs_file = IO::File->new($file_name, "w")) - or die("open failed: $!\n"); + or die(__x("open failed: {error_message}\n", error_message => $!)); $prefs_file->print("#\n"); - $prefs_file->print("# DO NOT EDIT! This is an automatically generated " - . "file.\n"); - $prefs_file->print("# Changes to this file may be lost or cause " - . "mtn-browse to malfunction.\n"); + $prefs_file-> + print(__("# DO NOT EDIT! This is an automatically generated file.\n")); + $prefs_file->print(__("# Changes to this file may be lost or cause ") + . __("mtn-browse to malfunction.\n")); $prefs_file->print("#\n"); $prefs_file->print(Data::Dumper->Dump([$preferences], ["*preferences"])); $prefs_file->close(); @@ -581,7 +615,8 @@ sub add_file_name_pattern_button_clicked ["modal"], "warning", "close", - sprintf("`%s' is an invalid\nfile name pattern.", $pattern)); + __x("`{pattern}' is an invalid\nfile name pattern.", + pattern=> $pattern)); $dialog->run(); $dialog->destroy(); return; @@ -604,9 +639,9 @@ sub add_file_name_pattern_button_clicked ["modal"], "warning", "close", - sprintf("`%s' is already used in MIME type\n`%s'.", - $pattern, - $match)); + __x("`{pattern}' is already used in MIME type\n`{mime_type}'.", + pattern => $pattern, + mime_type => $match)); $dialog->run(); $dialog->destroy(); return; @@ -808,7 +843,7 @@ sub get_preferences_window($$) set_model($instance->{mime_types_liststore}); $tv_column = Gtk2::TreeViewColumn->new(); - $tv_column->set_title("Mime Type"); + $tv_column->set_title(__("Mime Type")); $tv_column->set_resizable(TRUE); $tv_column->set_sizing("grow-only"); $tv_column->set_sort_column_id(MTLS_NAME_COLUMN); @@ -818,7 +853,7 @@ sub get_preferences_window($$) $instance->{mime_types_treeview}->append_column($tv_column); $tv_column = Gtk2::TreeViewColumn->new(); - $tv_column->set_title("File Name Patterns"); + $tv_column->set_title(__("File Name Patterns")); $tv_column->set_resizable(TRUE); $tv_column->set_sizing("grow-only"); $tv_column->set_sort_column_id(MTLS_PATTERNS_COLUMN); @@ -828,7 +863,7 @@ sub get_preferences_window($$) $instance->{mime_types_treeview}->append_column($tv_column); $tv_column = Gtk2::TreeViewColumn->new(); - $tv_column->set_title("Helper Application"); + $tv_column->set_title(__("Helper Application")); $tv_column->set_resizable(TRUE); $tv_column->set_sizing("grow-only"); $tv_column->set_sort_column_id(MTLS_HELPER_COLUMN); @@ -958,34 +993,7 @@ sub load_preferences_into_gui($) $instance->{fonts_fontbutton}-> set_font_name($instance->{preferences}->{fixed_font}); - for my $item ({widget => "annotation_prefix_1_foreground_colorbutton", - record => "annotate_prefix_1"}, - {widget => "annotation_prefix_1_background_colorbutton", - record => "annotate_prefix_1"}, - {widget => "annotation_text_1_foreground_colorbutton", - record => "annotate_text_1"}, - {widget => "annotation_text_1_background_colorbutton", - record => "annotate_text_1"}, - {widget => "annotation_prefix_2_foreground_colorbutton", - record => "annotate_prefix_2"}, - {widget => "annotation_prefix_2_background_colorbutton", - record => "annotate_prefix_2"}, - {widget => "annotation_text_2_foreground_colorbutton", - record => "annotate_text_2"}, - {widget => "annotation_text_2_background_colorbutton", - record => "annotate_text_2"}, - {widget => "revision_1_foreground_colorbutton", - record => "cmp_revision_1"}, - {widget => "revision_1_background_colorbutton", - record => "cmp_revision_1"}, - {widget => "revision_1_highlight_colorbutton", - record => "cmp_revision_1"}, - {widget => "revision_2_foreground_colorbutton", - record => "cmp_revision_2"}, - {widget => "revision_2_background_colorbutton", - record => "cmp_revision_2"}, - {widget => "revision_2_highlight_colorbutton", - record => "cmp_revision_2"}) + for my $item (@colour_mapping_table) { my $field; if ($item->{widget} =~ m/foreground/o) @@ -1076,34 +1084,7 @@ sub save_preferences_from_gui($) $instance->{preferences}->{fixed_font} = $instance->{fonts_fontbutton}->get_font_name(); - for my $item ({widget => "annotation_prefix_1_foreground_colorbutton", - record => "annotate_prefix_1"}, - {widget => "annotation_prefix_1_background_colorbutton", - record => "annotate_prefix_1"}, - {widget => "annotation_text_1_foreground_colorbutton", - record => "annotate_text_1"}, - {widget => "annotation_text_1_background_colorbutton", - record => "annotate_text_1"}, - {widget => "annotation_prefix_2_foreground_colorbutton", - record => "annotate_prefix_2"}, - {widget => "annotation_prefix_2_background_colorbutton", - record => "annotate_prefix_2"}, - {widget => "annotation_text_2_foreground_colorbutton", - record => "annotate_text_2"}, - {widget => "annotation_text_2_background_colorbutton", - record => "annotate_text_2"}, - {widget => "revision_1_foreground_colorbutton", - record => "cmp_revision_1"}, - {widget => "revision_1_background_colorbutton", - record => "cmp_revision_1"}, - {widget => "revision_1_highlight_colorbutton", - record => "cmp_revision_1"}, - {widget => "revision_2_foreground_colorbutton", - record => "cmp_revision_2"}, - {widget => "revision_2_background_colorbutton", - record => "cmp_revision_2"}, - {widget => "revision_2_highlight_colorbutton", - record => "cmp_revision_2"}) + for my $item (@colour_mapping_table) { my $field; if ($item->{widget} =~ m/foreground/o) ============================================================ --- Utilities.pm d4930c03d430af5ac4a2d0dcf1cb3d7d5a898c27 +++ Utilities.pm 0162a0665b728ecb82a1b3e880b869e3e9788f19 @@ -103,8 +103,11 @@ sub generate_revision_report($$$$;$) %revision_data, %seen, @unique); - my @types = - ("Added", "Removed", "Changed", "Renamed", "Attributes"); + my @types = (__("Added"), + __("Removed"), + __("Changed"), + __("Renamed"), + __("Attributes")); # Sort out colour attributes. @@ -124,7 +127,7 @@ sub generate_revision_report($$$$;$) # Revision id. $text_buffer->insert_with_tags_by_name($text_buffer->get_end_iter(), - "Revision id: ", + __("Revision id: "), $bold); $text_buffer->insert_with_tags_by_name($text_buffer->get_end_iter(), $revision_id . "\n\n", @@ -156,7 +159,7 @@ sub generate_revision_report($$$$;$) # Change log. $text_buffer->insert_with_tags_by_name($text_buffer->get_end_iter(), - "\nChange Log:\n", + __("\nChange Log:\n"), $bold); $text_buffer->insert_with_tags_by_name($text_buffer->get_end_iter(), sprintf("%s", $change_log), @@ -170,7 +173,7 @@ sub generate_revision_report($$$$;$) # Revision details. $text_buffer->insert_with_tags_by_name($text_buffer->get_end_iter(), - "\n\nChanges Made:\n", + __("\n\nChanges Made:\n"), $bold); foreach my $type (@types) { @@ -180,35 +183,35 @@ sub generate_revision_report($$$$;$) { if ($change->{type} eq "add_dir") { - push(@{$revision_data{"Added"}}, $change->{name} . "/"); + push(@{$revision_data{__("Added")}}, $change->{name} . "/"); } elsif ($change->{type} eq "add_file") { - push(@{$revision_data{"Added"}}, $change->{name}); + push(@{$revision_data{__("Added")}}, $change->{name}); } elsif ($change->{type} eq "delete") { - push(@{$revision_data{"Removed"}}, $change->{name}); + push(@{$revision_data{__("Removed")}}, $change->{name}); } elsif ($change->{type} eq "patch") { - push(@{$revision_data{"Changed"}}, $change->{name}); + push(@{$revision_data{__("Changed")}}, $change->{name}); } elsif ($change->{type} eq "rename") { - push(@{$revision_data{"Renamed"}}, + push(@{$revision_data{__("Renamed")}}, $change->{from_name} . " -> " . $change->{to_name}); } elsif ($change->{type} eq "clear") { - push(@{$revision_data{"Attributes"}}, - sprintf("%s: %s was cleared", - $change->{name}, - $change->{attribute})); + push(@{$revision_data{__("Attributes")}}, + __x("{name}: {attribute} was cleared", + name => $change->{name}, + attribute => $change->{attribute})); } - elsif ($change->{type} eq "clear" || $change->{type} eq "set") + elsif ($change->{type} eq "set") { - push(@{$revision_data{"Attributes"}}, + push(@{$revision_data{__("Attributes")}}, sprintf("%s: %s = %s", $change->{name}, $change->{attribute}, @@ -246,15 +249,16 @@ sub generate_revision_report($$$$;$) # Parent revision and manifest ids. - $text_buffer->insert_with_tags_by_name($text_buffer->get_end_iter(), - "\nParent revision id(s):\t", - $bold); $text_buffer->insert_with_tags_by_name ($text_buffer->get_end_iter(), + __("\nParent revision id(s):\t"), + $bold); + $text_buffer->insert_with_tags_by_name + ($text_buffer->get_end_iter(), join(" ", @parent_revision_ids) . "\n", $normal); $text_buffer->insert_with_tags_by_name($text_buffer->get_end_iter(), - "Manifest id:\t\t", + __("Manifest id:\t\t"), $bold); $text_buffer->insert_with_tags_by_name($text_buffer->get_end_iter(), $manifest_id, @@ -358,10 +362,10 @@ sub run_command($@) ["modal"], "warning", "close", - sprintf("The %s subprocess could not start,\n" - . "the system gave:\n%s", - Glib::Markup::escape_text($args[0]), - Glib::Markup::escape_text($@))); + __x("The {name} subprocess could not start,\n", + name => Glib::Markup::escape_text($args[0])) + . __x("the system gave:\n{error_message}", + error_message => Glib::Markup::escape_text($@))); $dialog->run(); $dialog->destroy(); return; @@ -415,8 +419,8 @@ sub run_command($@) ["modal"], "warning", "close", - sprintf("waitpid failed with:\n%s", - Glib::Markup::escape_text($!))); + __x("waitpid failed with:\n{error_message}", + error_message => Glib::Markup::escape_text($!))); $dialog->run(); $dialog->destroy(); return; @@ -430,12 +434,13 @@ sub run_command($@) ["modal"], "warning", "close", - sprintf("The %s subprocess failed with an exit status\n" - . "of %d and printed the following on stderr:\n" - . "%s", - Glib::Markup::escape_text($args[0]), - WEXITSTATUS($status), - Glib::Markup::escape_text(join("", @err)))); + __x("The {name} subprocess failed with an exit status\n", + name => Glib::Markup::escape_text($args[0])) + . __x("of {exit_code} and printed the following on stderr:\n", + exit_code => WEXITSTATUS($status)) + . __x("{error_message}", + error_message => + Glib::Markup::escape_text(join("", @err)))); $dialog->run(); $dialog->destroy(); return; @@ -447,9 +452,9 @@ sub run_command($@) ["modal"], "warning", "close", - sprintf("The %s subprocess was terminated by signal %d.", - Glib::Markup::escape_text($args[0]), - WTERMSIG($status))); + __x("The {name} subprocess was terminated by signal {number}.", + name => Glib::Markup::escape_text($args[0]), + number => WTERMSIG($status))); $dialog->run(); $dialog->destroy(); return; @@ -548,7 +553,7 @@ sub open_database($$$) $done, $ret_val); - $chooser_dialog = Gtk2::FileChooserDialog->new("Open Database", + $chooser_dialog = Gtk2::FileChooserDialog->new(__("Open Database"), $parent, "open", "gtk-cancel" => "cancel", @@ -605,7 +610,7 @@ sub open_database($$$) ["modal"], "warning", "close", - "Not a valid Monotone database."); + __("Not a valid Monotone database.")); $dialog->run(); $dialog->destroy(); } ============================================================ --- WindowManager.pm ac9adeeda684e518512e1adb1ca5bfd3a0287d2c +++ WindowManager.pm 8eb2da4972c53daad7f5a59ef5fe1f92e9b52833 @@ -184,15 +184,15 @@ sub manage($$$;$) # Check for instance record compliance. - croak("No window field found") unless (exists($instance->{window})); - croak("No appbar field found") + croak(__("No window field found")) unless (exists($instance->{window})); + croak(__("No appbar field found")) unless (exists($instance->{appbar}) || defined($grab_widget)); foreach my $field ("busy_widgets", "grab_widget", "type") { - croak($field . " field found - I manage this") + croak(__x("{field} field found - I manage this", field => $field)) if (exists($instance->{$field})); } - croak("Cannot manage unrealised windows") + croak(__("Cannot manage unrealised windows")) unless(defined($instance->{window}->window())); # Ok so store what we need in the instance record. @@ -328,7 +328,7 @@ sub make_busy($$$) my($this, $instance, $busy) = @_; - croak("Called with an unmanaged instance record") + croak(__("Called with an unmanaged instance record")) unless (exists($instance->{grab_widget})); # Create and store the cursors if we haven't done so already. ============================================================ --- mtn-browse 88920cff112f114139d36a0ba7cecbc14b305bca +++ mtn-browse 96fe56cb79dfe462e5d0fa65ef243ef5d3800f61 @@ -49,6 +49,7 @@ use lib LIB_PATH; use constant MIME_GLOB_FILE => "/usr/share/mime/globs"; } use lib LIB_PATH; +use lib "/home/aecoope/locale/lib/perl5/site_perl/5.8.5"; use strict; # ***** REQUIRED PACKAGES ***** @@ -67,9 +68,10 @@ use Gtk2::SourceView; use Gtk2::Helper; use Gtk2::Pango; use Gtk2::SourceView; +use Locale::TextDomain ("mtn-browse", "/home/aecoope/perl/locale"); use IO::File; use IPC::Open3; -use POSIX qw(:errno_h :sys_wait_h strftime); +use POSIX qw(:errno_h :locale_h :sys_wait_h strftime); use Symbol qw(gensym); use Text::Tabs; @@ -163,7 +165,6 @@ sub view_button_clicked_cb($$); # Initialise stuff. - set_locale Gtk2; Gnome2::Program->init("mtn-browse", 0.3); setup_sigchld_handler(\&sigchld_handler); $glade_file = LIB_PATH . "/UI/mtn-browse.glade"; @@ -186,7 +187,8 @@ sub view_button_clicked_cb($$); ["modal"], "warning", "close", - sprintf("Your preferences cannot be loaded:\n%s", $@)); + __x("Your preferences cannot be loaded:\n{error_message}", + error_message => $@)); $dialog->run(); $dialog->destroy(); exit(1); @@ -209,7 +211,8 @@ sub view_button_clicked_cb($$); ["modal"], "error", "close", - sprintf("%s\nThis is fatal, I am going to exit.", $@)); + __x("{error_message}\nThis is fatal, I am going to exit.", + error_message => $@)); $dialog->run(); $dialog->destroy(); exit(1); @@ -232,8 +235,8 @@ sub view_button_clicked_cb($$); ["modal"], "error", "close", - "Started in a workspace but I cannot\n" - . "find _MTN, I am going to exit."); + __("Started in a workspace but I cannot\n" + . "find _MTN, I am going to exit.")); $dialog->run(); $dialog->destroy(); exit(1); @@ -274,8 +277,8 @@ sub view_button_clicked_cb($$); ["modal"], "warning", "close", - sprintf("Cannot open database `%s'.", - $user_preferences->{default_mtn_db})); + __x("Cannot open database {database_name}.", + database_name => $user_preferences->{default_mtn_db})); $dialog->run(); $dialog->destroy(); } @@ -394,11 +397,11 @@ sub about_activate_cb($$) Gnome2::About->new ("mtn-browse", "0.3b", - "Copyright \xa9 2007-2009 Anthony Cooper", - "A graphical front-end browser for Monotone VCS databases", + __("Copyright \xa9 2007-2009 Anthony Cooper"), + __("A graphical front-end browser for Monotone VCS databases"), ["Anthony Cooper "], - "TBD", - "TBD", + __("TBD"), + __("TBD"), $large_logo)->run(); } @@ -522,7 +525,7 @@ sub properties_toolbutton_clicked_cb($$) ["modal"], "info", "close", - "Not implemented."); + __("Not implemented.")); $dialog->run(); $dialog->destroy(); @@ -587,7 +590,7 @@ sub help_toolbutton_clicked_cb($$) ["modal"], "info", "close", - "Not implemented."); + __("Not implemented.")); $dialog->run(); $dialog->destroy(); @@ -917,7 +920,7 @@ sub save_as_button_clicked_cb($$) $continue, $done); - $chooser_dialog = Gtk2::FileChooserDialog->new("Save As", + $chooser_dialog = Gtk2::FileChooserDialog->new(__("Save As"), $browser->{window}, "save", "gtk-cancel" => "cancel", @@ -947,8 +950,8 @@ sub save_as_button_clicked_cb($$) ["modal"], "question", "yes-no", - "File already exists.\nDo you want to replace it?"); - $dialog->set_title("Confirm"); + __("File already exists.\nDo you want to replace it?")); + $dialog->set_title(__("Confirm")); $continue = 0 if ($dialog->run() ne "yes"); $dialog->destroy(); } @@ -965,7 +968,7 @@ sub save_as_button_clicked_cb($$) ["modal"], "warning", "close", - $! . "."); + __x("{error_message}.", error_message => $!)); $dialog->run(); $dialog->destroy(); } @@ -1032,8 +1035,8 @@ sub view_button_clicked_cb($$) ($browser->{window}, ["modal"], "warning", - "Cannot generate temporary file name: ", - $! . "."); + __x("Cannot generate temporary file name:\n{error_message}.", + error_message => $!)); $dialog->run(); $dialog->destroy(); return; @@ -1048,7 +1051,7 @@ sub view_button_clicked_cb($$) ["modal"], "warning", "close", - $! . "."); + __x("{error_message}.", error_message => $!)); $dialog->run(); $dialog->destroy(); return; @@ -1110,7 +1113,7 @@ sub view_button_clicked_cb($$) ["modal"], "warning", "close", - "Unknown file type, not viewing."); + __("Unknown file type, not viewing.")); $dialog->run(); $dialog->destroy(); return; @@ -1128,9 +1131,9 @@ sub view_button_clicked_cb($$) ["modal"], "info", "close", - sprintf("No application is associated with\n" - . "Mime type `%s',\nusing Vi instead.", - $mime_type)); + __("No application is associated with\n") + . __x("Mime type {mime_type},\nusing Vi instead.", + mime_type => $mime_type)); system("xterm -e vi " . $file_name . " &"); } @@ -1527,7 +1530,7 @@ sub get_browser_window(;$$$$$) $browser->{manifest_browser_treeview}->append_column($tv_column); $tv_column = Gtk2::TreeViewColumn->new(); - $tv_column->set_title("File Name"); + $tv_column->set_title(__("File Name")); $tv_column->set_resizable(TRUE); $tv_column->set_sizing("fixed"); $tv_column->set_fixed_width(180); @@ -1538,7 +1541,7 @@ sub get_browser_window(;$$$$$) $browser->{manifest_browser_treeview}->append_column($tv_column); $tv_column = Gtk2::TreeViewColumn->new(); - $tv_column->set_title("Last Update"); + $tv_column->set_title(__("Last Update")); $tv_column->set_resizable(TRUE); $tv_column->set_sizing("grow-only"); $tv_column->set_sort_column_id(MLS_DATE_COLUMN); @@ -1548,7 +1551,7 @@ sub get_browser_window(;$$$$$) $browser->{manifest_browser_treeview}->append_column($tv_column); $tv_column = Gtk2::TreeViewColumn->new(); - $tv_column->set_title("Author"); + $tv_column->set_title(__("Author")); $tv_column->set_resizable(TRUE); $tv_column->set_sizing("grow-only"); $tv_column->set_sort_column_id(MLS_AUTHOR_COLUMN); @@ -1721,7 +1724,8 @@ sub update_browser_state($$) { $browser->{mtn}->get_option(\$db_name, "database"); set_label_value($browser->{database_name_value_label}, - sprintf(" (%s)", $db_name)); + __x(" ({database_name})", + database_name => $db_name)); } else { @@ -1762,14 +1766,14 @@ sub update_browser_state($$) # Get the new list of branches. - $browser->{appbar}->set_status("Fetching branch list"); + $browser->{appbar}->set_status(__("Fetching branch list")); gtk2_update(); $browser->{mtn}->branches(address@hidden) if (defined($browser->{mtn})); $browser->{branch_combo_details}->{list} = address@hidden; # Update the branch list combobox. - $browser->{appbar}->set_status("Populating branch list"); + $browser->{appbar}->set_status(__("Populating branch list")); gtk2_update(); my $counter = 1; $browser->{branch_comboboxentry}->get_model()->clear(); @@ -1813,7 +1817,7 @@ sub update_browser_state($$) if ($browser->{branch_combo_details}->{complete}) { - $browser->{appbar}->set_status("Fetching revision list"); + $browser->{appbar}->set_status(__("Fetching revision list")); gtk2_update(); get_branch_revisions($browser->{mtn}, $browser->{branch_combo_details}->{value}, @@ -1826,7 +1830,7 @@ sub update_browser_state($$) # Update the revision list combobox. $browser->{appbar}->set_progress_percentage(0); - $browser->{appbar}->set_status("Populating revision list"); + $browser->{appbar}->set_status(__("Populating revision list")); gtk2_update(); my $counter = 1; $browser->{revision_comboboxentry}->get_model()->clear(); @@ -1876,7 +1880,7 @@ sub update_browser_state($$) # Get the new manifest. - $browser->{appbar}->set_status("Fetching manifest"); + $browser->{appbar}->set_status(__("Fetching manifest")); gtk2_update(); if ($browser->{revision_combo_details}->{complete}) { @@ -1886,12 +1890,12 @@ sub update_browser_state($$) { my $message; $message = - sprintf("The `%s' tag is not unique on this branch.\n" - . "Please either select the revision by its " - . "id\n" - . "or use the Advanced Find feature.\n" - . "The matching revision ids are:", - $browser->{revision_combo_details}->{value}); + __x("The `{tag_name}' tag is not unique on this branch.\n", + tag_name => + $browser->{revision_combo_details}->{value}) + . __("Please either select the revision by its id\n") + . __("or use the Advanced Find feature.\n") + . __("The matching revision ids are:"); foreach my $item (@revision_ids) { $message .= "\n" . Glib::Markup::escape_text($item); @@ -1948,7 +1952,7 @@ sub update_browser_state($$) # Update the directory list combobox. $browser->{appbar}->set_progress_percentage(0); - $browser->{appbar}->set_status("Populating directory list"); + $browser->{appbar}->set_status(__("Populating directory list")); gtk2_update(); my $counter = 1; $browser->{directory_comboboxentry}->get_model()->clear(); @@ -2009,7 +2013,7 @@ sub update_browser_state($$) # Update the directory tree view. - $browser->{appbar}->set_status("Populating file details"); + $browser->{appbar}->set_status(__("Populating file details")); $counter = 1; $taking_our_time = 0; get_revision_ids($browser, address@hidden); @@ -2286,7 +2290,8 @@ sub display_file($$) $browser->{file_view_svbuffer}-> set_text("<" - . (defined($mime_type) ? $mime_type : "Unknown Contents") + . (defined($mime_type) + ? $mime_type : __("Unknown Contents")) . ">"); } @@ -2331,7 +2336,7 @@ sub display_file($$) # can do is to hex dump it out. $browser->{file_view_svbuffer}-> - set_text("<" . $mime_type . "> Hex dump:\n"); + set_text("<" . $mime_type . "> " . __("Hex dump:\n")); $browser->{file_view_svbuffer}-> insert($browser->{file_view_svbuffer}->get_end_iter(), ${hex_dump(\$contents)}); @@ -2415,9 +2420,10 @@ sub mtn_error_handler($$) ["modal"], "warning", "close", - sprintf("Problem with monotone request, got:\n%s\n" - . "This should not be happening!", - Glib::Markup::escape_text($message))); + __("Problem with monotone request, got:\n") + . __x("{error_message}\n", + error_message => Glib::Markup::escape_text($message)) + . __("This should not be happening!")); $dialog->run(); $dialog->destroy(); die($message); @@ -2429,10 +2435,10 @@ sub mtn_error_handler($$) ["modal"], "error", "close", - sprintf("Monotone process unexpectedly exiting with:\n" - . "%s\n" - . "This is fatal, I am going to exit.", - Glib::Markup::escape_text($message))); + __("Monotone process unexpectedly exiting with:\n") + . __x("{error_message}\n", + error_message => Glib::Markup::escape_text($message)) + . __("This is fatal, I am going to exit.")); $dialog->run(); $dialog->destroy(); Gtk2->main_quit() unless (Gtk2->main_level() == 0); @@ -2475,22 +2481,28 @@ sub sigchld_handler() if (exists($instance->{mtn}) && defined($instance->{mtn}) && $instance->{mtn}->get_pid() == $pid) { + my $message; $instance->{mtn}->closedown(); + if (WIFSIGNALED($status)) + { + $message = __x("terminated by signal {number}", + number => WTERMSIG($status)); + } + else + { + $message = __x("exited with status {number}", + number => WEXITSTATUS($status)); + } my $dialog = Gtk2::MessageDialog->new (undef, ["modal"], "warning", "close", - sprintf("The mtn subprocess just unexpectedly\n" - . "exited (%s).\n" - . "This should not be happening!\n" - . "It will be restarted when " - . "needed.", - WIFSIGNALED($status) ? - sprintf("terminated by signal %d", - WTERMSIG($status)) : - sprintf("exited with status %d", - WEXITSTATUS($status)))); + __("The mtn subprocess just unexpectedly\n") + . __x("exited ({error_message}).\n", + error_message => $message) + . __("This should not be happening!\n") + . __("It will be restarted when needed.")); $dialog->run(); $dialog->destroy(); return 1; @@ -2500,7 +2512,8 @@ sub sigchld_handler() } } - warn("waitpid failed: $!") if ($pid < 0 && $! != ECHILD); + warn(__x("waitpid failed: {error_message}", error_message => $!)) + if ($pid < 0 && $! != ECHILD); } # @@ -2529,7 +2542,8 @@ sub setup_sigchld_handler($) # with Gtk2 as a file activity handler. This is efficient and safer than # some alternatives. - pipe($reader, $writer) or die("pipe failed: $!"); + pipe($reader, $writer) + or die(__x("pipe failed: {error_message}", error_message => $!)); $SIG{CHLD} = sub { syswrite($writer, "\n", 1); }; Gtk2::Helper->add_watch(fileno($reader), "in", sub {