git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 12/14] i18n: send-email: mark warnings and errors for translation

From
Vasco Almeida <vascomalmeida@sapo.pt>
Date
Oct 5, 2016, 17:21 UTC
Message-ID
<20161005172110.30801-13-vascomalmeida@sapo.pt>
In-Reply-To
<20161005172110.30801-1-vascomalmeida@sapo.pt>
Mark warnings, errors and other messages for translation.
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
 git-send-email.perl | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 78eb59b..982c6c0 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -118,20 +118,20 @@ sub format_2822_time {
 	my $localmin = $localtm[1] + $localtm[2] * 60;
 	my $gmtmin = $gmttm[1] + $gmttm[2] * 60;
 	if ($localtm[0] != $gmttm[0]) {
-		die "local zone differs from GMT by a non-minute interval\n";
+		die __("local zone differs from GMT by a non-minute interval\n");
 	}
 	if ((($gmttm[6] + 1) % 7) == $localtm[6]) {
 		$localmin += 1440;
 	} elsif ((($gmttm[6] - 1) % 7) == $localtm[6]) {
 		$localmin -= 1440;
 	} elsif ($gmttm[6] != $localtm[6]) {
-		die "local time offset greater than or equal to 24 hours\n";
+		die __("local time offset greater than or equal to 24 hours\n");
 	}
 	my $offset = $localmin - $gmtmin;
 	my $offhour = $offset / 60;
 	my $offmin = abs($offset % 60);
 	if (abs($offhour) >= 24) {
-		die ("local time offset greater than or equal to 24 hours\n");
+		die __("local time offset greater than or equal to 24 hours\n");
 	}
 
 	return sprintf("%s, %2d %s %d %02d:%02d:%02d %s%02d%02d",
@@ -199,13 +199,13 @@ sub do_edit {
 		map {
 			system('sh', '-c', $editor.' "$@"', $editor, $_);
 			if (($? & 127) || ($? >> 8)) {
-				die("the editor exited uncleanly, aborting everything");
+				die(__("the editor exited uncleanly, aborting everything"));
 			}
 		} @_;
 	} else {
 		system('sh', '-c', $editor.' "$@"', $editor, @_);
 		if (($? & 127) || ($? >> 8)) {
-			die("the editor exited uncleanly, aborting everything");
+			die(__("the editor exited uncleanly, aborting everything"));
 		}
 	}
 }
@@ -299,7 +299,7 @@ my $help;
 my $rc = GetOptions("h" => \$help,
                     "dump-aliases" => \$dump_aliases);
 usage() unless $rc;
-die "--dump-aliases incompatible with other options\n"
+die __("--dump-aliases incompatible with other options\n")
     if !$help and $dump_aliases and @ARGV;
 $rc = GetOptions(
 		    "sender|from=s" => \$sender,
@@ -362,7 +362,7 @@ unless ($rc) {
     usage();
 }
 
-die "Cannot run git format-patch from outside a repository\n"
+die __("Cannot run git format-patch from outside a repository\n")
 	if $format_patch and not $repo;
 
 # Now, let's fill any that aren't set in with defaults:
@@ -617,7 +617,7 @@ while (defined(my $f = shift @ARGV)) {
 }
 
 if (@rev_list_opts) {
-	die "Cannot run git format-patch from outside a repository\n"
+	die __("Cannot run git format-patch from outside a repository\n")
 		unless $repo;
 	push @files, $repo->command('format-patch', '-o', tempdir(CLEANUP => 1), @rev_list_opts);
 }
@@ -638,7 +638,7 @@ if (@files) {
 		print $_,"\n" for (@files);
 	}
 } else {
-	print STDERR "\nNo patch files specified!\n\n";
+	print STDERR __("\nNo patch files specified!\n\n");
 	usage();
 }
 
@@ -730,7 +730,7 @@ EOT
 			$sender = $1;
 			next;
 		} elsif (/^(?:To|Cc|Bcc):/i) {
-			print "To/Cc/Bcc fields are not interpreted yet, they have been ignored\n";
+			print __("To/Cc/Bcc fields are not interpreted yet, they have been ignored\n");
 			next;
 		}
 		print $c2 $_;
@@ -739,7 +739,7 @@ EOT
 	close $c2;
 
 	if ($summary_empty) {
-		print "Summary email is empty, skipping it\n";
+		print __("Summary email is empty, skipping it\n");
 		$compose = -1;
 	}
 } elsif ($annotate) {
@@ -1314,7 +1314,7 @@ Message-Id: $message_id
 		$_ = ask(__("Send this email? ([y]es|[n]o|[q]uit|[a]ll): "),
 		         valid_re => qr/^(?:yes|y|no|n|quit|q|all|a)/i,
 		         default => $ask_default);
-		die "Send this email reply required" unless defined $_;
+		die __("Send this email reply required") unless defined $_;
 		if (/^n/i) {
 			return 0;
 		} elsif (/^q/i) {
@@ -1340,7 +1340,7 @@ Message-Id: $message_id
 	} else {
 
 		if (!defined $smtp_server) {
-			die "The required SMTP server is not properly defined."
+			die __("The required SMTP server is not properly defined.")
 		}
 
 		if ($smtp_encryption eq 'ssl') {
@@ -1425,10 +1425,10 @@ Message-Id: $message_id
 		}
 		print $header, "\n";
 		if ($smtp) {
-			print "Result: ", $smtp->code, ' ',
+			print __("Result: "), $smtp->code, ' ',
 				($smtp->message =~ /\n([^\n]+\n)$/s), "\n";
 		} else {
-			print "Result: OK\n";
+			print __("Result: OK\n");
 		}
 	}
 
@@ -1701,7 +1701,7 @@ sub apply_transfer_encoding {
 	$message = MIME::Base64::decode($message)
 		if ($from eq 'base64');
 
-	die "cannot send message as 7bit"
+	die __("cannot send message as 7bit")
 		if ($to eq '7bit' and $message =~ /[^[:ascii:]]/);
 	return $message
 		if ($to eq '7bit' or $to eq '8bit');
@@ -1709,7 +1709,7 @@ sub apply_transfer_encoding {
 		if ($to eq 'quoted-printable');
 	return MIME::Base64::encode($message, "\n")
 		if ($to eq 'base64');
-	die "invalid transfer encoding";
+	die __("invalid transfer encoding");
 }
 
 sub unique_email_list {
-- 
2.7.4
Previous: Vasco AlmeidaNext: Vasco Almeida
Message 15 of 63 in “Mark strings in Perl scripts for translation”
  1. 00/14 Mark strings in Perl scripts for translationVasco Almeida, Oct 5, 2016
  2. 02/14 i18n: add--interactive: mark simple here-documents for translationVasco Almeida, Oct 5, 2016
  3. 04/14 i18n: clean.c: match string with git-add--interactive.perlVasco Almeida, Oct 5, 2016
  4. 05/14 i18n: add--interactive: mark plural stringsVasco Almeida, Oct 5, 2016
  5. Junio C HamanoOct 5, 2016
  6. 03/14 i18n: add--interactive: mark strings with interpolation for translationVasco Almeida, Oct 5, 2016
  7. Junio C HamanoOct 5, 2016
  8. 01/14 i18n: add--interactive: mark strings for translationVasco Almeida, Oct 5, 2016
  9. 06/14 i18n: add--interactive: mark patch prompt for translationVasco Almeida, Oct 5, 2016
  10. 07/14 i18n: add--interactive: i18n of help_patch_cmdVasco Almeida, Oct 5, 2016
  11. 08/14 i18n: add--interactive: mark edit_hunk_manually message for translationVasco Almeida, Oct 5, 2016
  12. 09/14 i18n: add--interactive: remove %patch_modes entriesVasco Almeida, Oct 5, 2016
  13. 10/14 i18n: add--interactive: mark status words for translationVasco Almeida, Oct 5, 2016
  14. 11/14 i18n: send-email: mark strings for translationVasco Almeida, Oct 5, 2016
  15. 12/14 i18n: send-email: mark warnings and errors for translationVasco Almeida, Oct 5, 2016
  16. 13/14 i18n: send-email: mark string with interpolation for translationVasco Almeida, Oct 5, 2016
  17. 14/14 i18n: difftool: mark warnings for translationVasco Almeida, Oct 5, 2016
  18. Jakub NarębskiOct 5, 2016
  19. 00/14 Mark strings in Perl scripts for translationVasco Almeida, Oct 10, 2016
  20. 01/14 i18n: add--interactive: mark strings for translationVasco Almeida, Oct 10, 2016
  21. Junio C HamanoOct 19, 2016
  22. Vasco AlmeidaOct 20, 2016
  23. Junio C HamanoOct 20, 2016
  24. 02/14 i18n: add--interactive: mark simple here-documents for translationVasco Almeida, Oct 10, 2016
  25. 03/14 i18n: add--interactive: mark strings with interpolation for translationVasco Almeida, Oct 10, 2016
  26. 04/14 i18n: clean.c: match string with git-add--interactive.perlVasco Almeida, Oct 10, 2016
  27. 05/14 i18n: add--interactive: mark plural stringsVasco Almeida, Oct 10, 2016
  28. Junio C HamanoOct 19, 2016
  29. Vasco AlmeidaOct 20, 2016
  30. Vasco AlmeidaOct 20, 2016
  31. Junio C HamanoOct 20, 2016
  32. 06/14 i18n: add--interactive: mark patch prompt for translationVasco Almeida, Oct 10, 2016
  33. 07/14 i18n: add--interactive: i18n of help_patch_cmdVasco Almeida, Oct 10, 2016
  34. 08/14 i18n: add--interactive: mark edit_hunk_manually message for translationVasco Almeida, Oct 10, 2016
  35. Vasco AlmeidaNov 7, 2016
  36. 09/14 i18n: add--interactive: remove %patch_modes entriesVasco Almeida, Oct 10, 2016
  37. 10/14 i18n: add--interactive: mark status words for translationVasco Almeida, Oct 10, 2016
  38. 11/14 i18n: send-email: mark strings for translationVasco Almeida, Oct 10, 2016
  39. 12/14 i18n: send-email: mark warnings and errors for translationVasco Almeida, Oct 10, 2016
  40. 13/14 i18n: send-email: mark string with interpolation for translationVasco Almeida, Oct 10, 2016
  41. 14/14 i18n: difftool: mark warnings for translationVasco Almeida, Oct 10, 2016
  42. Junio C HamanoOct 27, 2016
  43. 00/16 Mark strings in Perl scripts for translationVasco Almeida, Nov 8, 2016
  44. 02/16 i18n: add--interactive: mark strings for translationVasco Almeida, Nov 8, 2016
  45. 09/16 i18n: add--interactive: mark edit_hunk_manually message for translationVasco Almeida, Nov 8, 2016
  46. 10/16 i18n: add--interactive: remove %patch_modes entriesVasco Almeida, Nov 8, 2016
  47. 01/16 Git.pm: add subroutines for commenting linesVasco Almeida, Nov 8, 2016
  48. Junio C HamanoNov 9, 2016
  49. Vasco AlmeidaNov 9, 2016
  50. Jakub NarębskiNov 9, 2016
  51. Junio C HamanoNov 9, 2016
  52. 08/16 i18n: add--interactive: i18n of help_patch_cmdVasco Almeida, Nov 8, 2016
  53. 16/16 i18n: difftool: mark warnings for translationVasco Almeida, Nov 8, 2016
  54. 15/16 i18n: send-email: mark composing message for translationVasco Almeida, Nov 8, 2016
  55. 14/16 i18n: send-email: mark string with interpolation for translationVasco Almeida, Nov 8, 2016
  56. 13/16 i18n: send-email: mark warnings and errors for translationVasco Almeida, Nov 8, 2016
  57. 12/16 i18n: send-email: mark strings for translationVasco Almeida, Nov 8, 2016
  58. 07/16 i18n: add--interactive: mark patch prompt for translationVasco Almeida, Nov 8, 2016
  59. 11/16 i18n: add--interactive: mark status words for translationVasco Almeida, Nov 8, 2016
  60. 06/16 i18n: add--interactive: mark plural stringsVasco Almeida, Nov 8, 2016
  61. 05/16 i18n: clean.c: match string with git-add--interactive.perlVasco Almeida, Nov 8, 2016
  62. 04/16 i18n: add--interactive: mark strings with interpolation for translationVasco Almeida, Nov 8, 2016
  63. 03/16 i18n: add--interactive: mark simple here-documents for translationVasco Almeida, Nov 8, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.