Skip to content

Commit a4dde4c

Browse files
vascoolgitster
authored andcommitted
i18n: send-email: mark strings for translation
Mark strings often displayed to the user for translation. Signed-off-by: Vasco Almeida <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 55aa044 commit a4dde4c

File tree

1 file changed

+32
-22
lines changed

1 file changed

+32
-22
lines changed

git-send-email.perl

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use File::Spec::Functions qw(catfile);
2929
use Error qw(:try);
3030
use Git;
31+
use Git::I18N;
3132

3233
Getopt::Long::Configure qw/ pass_through /;
3334

@@ -797,12 +798,12 @@ sub file_declares_8bit_cte {
797798
}
798799

799800
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");
802803
foreach my $f (sort keys %broken_encoding) {
803804
print " $f\n";
804805
}
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]? "),
806807
valid_re => qr/.{4}/, confirm_only => 1,
807808
default => "UTF-8");
808809
}
@@ -829,7 +830,7 @@ sub file_declares_8bit_cte {
829830
# But it's a no-op to run sanitize_address on an already sanitized address.
830831
$sender = sanitize_address($sender);
831832

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)?");
833834
my $prompting = 0;
834835
if (!@initial_to && !defined $to_cmd) {
835836
my $to = ask("$to_whom ",
@@ -859,7 +860,7 @@ sub expand_one_alias {
859860

860861
if ($thread && !defined $initial_reply_to && $prompting) {
861862
$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)? "),
863864
default => "",
864865
valid_re => qr/\@.*\./, confirm_only => 1);
865866
}
@@ -918,7 +919,10 @@ sub validate_address {
918919
my $address = shift;
919920
while (!extract_valid_address($address)) {
920921
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): "),
922926
valid_re => qr/^(?:quit|q|drop|d|edit|e)/i,
923927
default => 'q');
924928
if (/^d/i) {
@@ -1293,17 +1297,23 @@ sub send_message {
12931297
if ($needs_confirm eq "inform") {
12941298
$confirm_unconfigured = 0; # squelch this message for the rest of this run
12951299
$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
13051312
}
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): "),
13071317
valid_re => qr/^(?:yes|y|no|n|quit|q|all|a)/i,
13081318
default => $ask_default);
13091319
die "Send this email reply required" unless defined $_;
@@ -1405,7 +1415,7 @@ sub send_message {
14051415
if ($quiet) {
14061416
printf (($dry_run ? "Dry-" : "")."Sent %s\n", $subject);
14071417
} else {
1408-
print (($dry_run ? "Dry-" : "")."OK. Log says:\n");
1418+
print($dry_run ? __("Dry-OK. Log says:\n") : __("OK. Log says:\n"));
14091419
if (!file_name_is_absolute($smtp_server)) {
14101420
print "Server: $smtp_server\n";
14111421
print "MAIL FROM:<$raw_from>\n";
@@ -1480,13 +1490,13 @@ sub send_message {
14801490
$sauthor = sanitize_address($author);
14811491
next if $suppress_cc{'author'};
14821492
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"),
14841494
$1, $_) unless $quiet;
14851495
push @cc, $1;
14861496
}
14871497
elsif (/^To:\s+(.*)$/i) {
14881498
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"),
14901500
$addr, $_) unless $quiet;
14911501
push @to, $addr;
14921502
}
@@ -1500,7 +1510,7 @@ sub send_message {
15001510
} else {
15011511
next if ($suppress_cc{'cc'});
15021512
}
1503-
printf("(mbox) Adding cc: %s from line '%s'\n",
1513+
printf(__("(mbox) Adding cc: %s from line '%s'\n"),
15041514
$addr, $_) unless $quiet;
15051515
push @cc, $addr;
15061516
}
@@ -1534,7 +1544,7 @@ sub send_message {
15341544
# So let's support that, too.
15351545
$input_format = 'lots';
15361546
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"),
15381548
$_, $_) unless $quiet;
15391549
push @cc, $_;
15401550
} elsif (!defined $subject) {
@@ -1557,7 +1567,7 @@ sub send_message {
15571567
next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
15581568
}
15591569
push @cc, $c;
1560-
printf("(body) Adding cc: %s from line '%s'\n",
1570+
printf(__("(body) Adding cc: %s from line '%s'\n"),
15611571
$c, $_) unless $quiet;
15621572
}
15631573
}

0 commit comments

Comments
 (0)