i18n: send-email: mark strings for translation
Mark strings often displayed to the user for translation. Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Vasco Almeida committed
Dec 14, 2016 at 11:54 UTC
a4dde4c4e9059416a6249dce3958ffce5a134e0f
1 file changed
+32
-22
git-send-email.perl
+32
-22
@@ -28,6 +28,7 @@ use File::Temp qw/ tempdir tempfile /;
28
use File::Spec::Functions qw(catfile);
29
use Error qw(:try);
30
use Git;
31
+use Git::I18N;
32
33
Getopt::Long::Configure qw/ pass_through /;
34
@@ -797,12 +798,12 @@ foreach my $f (@files) {
798
}
799
800
if (!defined $auto_8bit_encoding && scalar %broken_encoding) {
800
- print "The following files are 8bit, but do not declare " .
801
- "a Content-Transfer-Encoding.\n";
801
+ print __("The following files are 8bit, but do not declare " .
802
+ "a Content-Transfer-Encoding.\n");
803
foreach my $f (sort keys %broken_encoding) {
804
print " $f\n";
805
}
805
- $auto_8bit_encoding = ask("Which 8bit encoding should I declare [UTF-8]? ",
806
+ $auto_8bit_encoding = ask(__("Which 8bit encoding should I declare [UTF-8]? "),
807
valid_re => qr/.{4}/, confirm_only => 1,
808
default => "UTF-8");
809
}
@@ -829,7 +830,7 @@ if (defined $sender) {
830
# But it's a no-op to run sanitize_address on an already sanitized address.
831
$sender = sanitize_address($sender);
832
832
-my $to_whom = "To whom should the emails be sent (if anyone)?";
833
+my $to_whom = __("To whom should the emails be sent (if anyone)?");
834
my $prompting = 0;
835
if (!@initial_to && !defined $to_cmd) {
836
my $to = ask("$to_whom ",
@@ -859,7 +860,7 @@ sub expand_one_alias {
860
861
if ($thread && !defined $initial_reply_to && $prompting) {
862
$initial_reply_to = ask(
862
- "Message-ID to be used as In-Reply-To for the first email (if any)? ",
863
+ __("Message-ID to be used as In-Reply-To for the first email (if any)? "),
864
default => "",
865
valid_re => qr/\@.*\./, confirm_only => 1);
866
}
@@ -918,7 +919,10 @@ sub validate_address {
919
my $address = shift;
920
while (!extract_valid_address($address)) {
921
print STDERR "error: unable to extract a valid address from: $address\n";
921
- $_ = ask("What to do with this address? ([q]uit|[d]rop|[e]dit): ",
922
+ # TRANSLATORS: Make sure to include [q] [d] [e] in your
923
+ # translation. The program will only accept English input
924
+ # at this point.
925
+ $_ = ask(__("What to do with this address? ([q]uit|[d]rop|[e]dit): "),
926
valid_re => qr/^(?:quit|q|drop|d|edit|e)/i,
927
default => 'q');
928
if (/^d/i) {
@@ -1293,17 +1297,23 @@ Message-Id: $message_id
1297
if ($needs_confirm eq "inform") {
1298
$confirm_unconfigured = 0; # squelch this message for the rest of this run
1299
$ask_default = "y"; # assume yes on EOF since user hasn't explicitly asked for confirmation
1296
- print " The Cc list above has been expanded by additional\n";
1297
- print " addresses found in the patch commit message. By default\n";
1298
- print " send-email prompts before sending whenever this occurs.\n";
1299
- print " This behavior is controlled by the sendemail.confirm\n";
1300
- print " configuration setting.\n";
1301
- print "\n";
1302
- print " For additional information, run 'git send-email --help'.\n";
1303
- print " To retain the current behavior, but squelch this message,\n";
1304
- print " run 'git config --global sendemail.confirm auto'.\n\n";
1300
+ print __ <<EOF ;
1301
+ The Cc list above has been expanded by additional
1302
+ addresses found in the patch commit message. By default
1303
+ send-email prompts before sending whenever this occurs.
1304
+ This behavior is controlled by the sendemail.confirm
1305
+ configuration setting.
1306
+
1307
+ For additional information, run 'git send-email --help'.
1308
+ To retain the current behavior, but squelch this message,
1309
+ run 'git config --global sendemail.confirm auto'.
1310
+
1311
+EOF
1312
}
1306
- $_ = ask("Send this email? ([y]es|[n]o|[q]uit|[a]ll): ",
1313
+ # TRANSLATORS: Make sure to include [y] [n] [q] [a] in your
1314
+ # translation. The program will only accept English input
1315
+ # at this point.
1316
+ $_ = ask(__("Send this email? ([y]es|[n]o|[q]uit|[a]ll): "),
1317
valid_re => qr/^(?:yes|y|no|n|quit|q|all|a)/i,
1318
default => $ask_default);
1319
die "Send this email reply required" unless defined $_;
@@ -1405,7 +1415,7 @@ Message-Id: $message_id
1415
if ($quiet) {
1416
printf (($dry_run ? "Dry-" : "")."Sent %s\n", $subject);
1417
} else {
1408
- print (($dry_run ? "Dry-" : "")."OK. Log says:\n");
1418
+ print($dry_run ? __("Dry-OK. Log says:\n") : __("OK. Log says:\n"));
1419
if (!file_name_is_absolute($smtp_server)) {
1420
print "Server: $smtp_server\n";
1421
print "MAIL FROM:<$raw_from>\n";
@@ -1480,13 +1490,13 @@ foreach my $t (@files) {
1490
$sauthor = sanitize_address($author);
1491
next if $suppress_cc{'author'};
1492
next if $suppress_cc{'self'} and $sauthor eq $sender;
1483
- printf("(mbox) Adding cc: %s from line '%s'\n",
1493
+ printf(__("(mbox) Adding cc: %s from line '%s'\n"),
1494
$1, $_) unless $quiet;
1495
push @cc, $1;
1496
}
1497
elsif (/^To:\s+(.*)$/i) {
1498
foreach my $addr (parse_address_line($1)) {
1489
- printf("(mbox) Adding to: %s from line '%s'\n",
1499
+ printf(__("(mbox) Adding to: %s from line '%s'\n"),
1500
$addr, $_) unless $quiet;
1501
push @to, $addr;
1502
}
@@ -1500,7 +1510,7 @@ foreach my $t (@files) {
1510
} else {
1511
next if ($suppress_cc{'cc'});
1512
}
1503
- printf("(mbox) Adding cc: %s from line '%s'\n",
1513
+ printf(__("(mbox) Adding cc: %s from line '%s'\n"),
1514
$addr, $_) unless $quiet;
1515
push @cc, $addr;
1516
}
@@ -1534,7 +1544,7 @@ foreach my $t (@files) {
1544
# So let's support that, too.
1545
$input_format = 'lots';
1546
if (@cc == 0 && !$suppress_cc{'cc'}) {
1537
- printf("(non-mbox) Adding cc: %s from line '%s'\n",
1547
+ printf(__("(non-mbox) Adding cc: %s from line '%s'\n"),
1548
$_, $_) unless $quiet;
1549
push @cc, $_;
1550
} elsif (!defined $subject) {
@@ -1557,7 +1567,7 @@ foreach my $t (@files) {
1567
next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
1568
}
1569
push @cc, $c;
1560
- printf("(body) Adding cc: %s from line '%s'\n",
1570
+ printf(__("(body) Adding cc: %s from line '%s'\n"),
1571
$c, $_) unless $quiet;
1572
}
1573
}