Skip to content

Commit 27fe88f

Browse files
vascoolgitster
authored andcommitted
i18n: send-email: mark warnings and errors for translation
Mark warnings, errors and other messages for translation. Signed-off-by: Vasco Almeida <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 38fa556 commit 27fe88f

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

git-send-email.perl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,20 @@ sub format_2822_time {
118118
my $localmin = $localtm[1] + $localtm[2] * 60;
119119
my $gmtmin = $gmttm[1] + $gmttm[2] * 60;
120120
if ($localtm[0] != $gmttm[0]) {
121-
die "local zone differs from GMT by a non-minute interval\n";
121+
die __("local zone differs from GMT by a non-minute interval\n");
122122
}
123123
if ((($gmttm[6] + 1) % 7) == $localtm[6]) {
124124
$localmin += 1440;
125125
} elsif ((($gmttm[6] - 1) % 7) == $localtm[6]) {
126126
$localmin -= 1440;
127127
} elsif ($gmttm[6] != $localtm[6]) {
128-
die "local time offset greater than or equal to 24 hours\n";
128+
die __("local time offset greater than or equal to 24 hours\n");
129129
}
130130
my $offset = $localmin - $gmtmin;
131131
my $offhour = $offset / 60;
132132
my $offmin = abs($offset % 60);
133133
if (abs($offhour) >= 24) {
134-
die ("local time offset greater than or equal to 24 hours\n");
134+
die __("local time offset greater than or equal to 24 hours\n");
135135
}
136136

137137
return sprintf("%s, %2d %s %d %02d:%02d:%02d %s%02d%02d",
@@ -199,13 +199,13 @@ sub do_edit {
199199
map {
200200
system('sh', '-c', $editor.' "$@"', $editor, $_);
201201
if (($? & 127) || ($? >> 8)) {
202-
die("the editor exited uncleanly, aborting everything");
202+
die(__("the editor exited uncleanly, aborting everything"));
203203
}
204204
} @_;
205205
} else {
206206
system('sh', '-c', $editor.' "$@"', $editor, @_);
207207
if (($? & 127) || ($? >> 8)) {
208-
die("the editor exited uncleanly, aborting everything");
208+
die(__("the editor exited uncleanly, aborting everything"));
209209
}
210210
}
211211
}
@@ -299,7 +299,7 @@ sub signal_handler {
299299
my $rc = GetOptions("h" => \$help,
300300
"dump-aliases" => \$dump_aliases);
301301
usage() unless $rc;
302-
die "--dump-aliases incompatible with other options\n"
302+
die __("--dump-aliases incompatible with other options\n")
303303
if !$help and $dump_aliases and @ARGV;
304304
$rc = GetOptions(
305305
"sender|from=s" => \$sender,
@@ -362,7 +362,7 @@ sub signal_handler {
362362
usage();
363363
}
364364

365-
die "Cannot run git format-patch from outside a repository\n"
365+
die __("Cannot run git format-patch from outside a repository\n")
366366
if $format_patch and not $repo;
367367

368368
# Now, let's fill any that aren't set in with defaults:
@@ -617,7 +617,7 @@ sub is_format_patch_arg {
617617
}
618618

619619
if (@rev_list_opts) {
620-
die "Cannot run git format-patch from outside a repository\n"
620+
die __("Cannot run git format-patch from outside a repository\n")
621621
unless $repo;
622622
push @files, $repo->command('format-patch', '-o', tempdir(CLEANUP => 1), @rev_list_opts);
623623
}
@@ -638,7 +638,7 @@ sub is_format_patch_arg {
638638
print $_,"\n" for (@files);
639639
}
640640
} else {
641-
print STDERR "\nNo patch files specified!\n\n";
641+
print STDERR __("\nNo patch files specified!\n\n");
642642
usage();
643643
}
644644

@@ -730,7 +730,7 @@ sub get_patch_subject {
730730
$sender = $1;
731731
next;
732732
} elsif (/^(?:To|Cc|Bcc):/i) {
733-
print "To/Cc/Bcc fields are not interpreted yet, they have been ignored\n";
733+
print __("To/Cc/Bcc fields are not interpreted yet, they have been ignored\n");
734734
next;
735735
}
736736
print $c2 $_;
@@ -739,7 +739,7 @@ sub get_patch_subject {
739739
close $c2;
740740

741741
if ($summary_empty) {
742-
print "Summary email is empty, skipping it\n";
742+
print __("Summary email is empty, skipping it\n");
743743
$compose = -1;
744744
}
745745
} elsif ($annotate) {
@@ -1315,7 +1315,7 @@ sub send_message {
13151315
$_ = ask(__("Send this email? ([y]es|[n]o|[q]uit|[a]ll): "),
13161316
valid_re => qr/^(?:yes|y|no|n|quit|q|all|a)/i,
13171317
default => $ask_default);
1318-
die "Send this email reply required" unless defined $_;
1318+
die __("Send this email reply required") unless defined $_;
13191319
if (/^n/i) {
13201320
return 0;
13211321
} elsif (/^q/i) {
@@ -1341,7 +1341,7 @@ sub send_message {
13411341
} else {
13421342

13431343
if (!defined $smtp_server) {
1344-
die "The required SMTP server is not properly defined."
1344+
die __("The required SMTP server is not properly defined.")
13451345
}
13461346

13471347
if ($smtp_encryption eq 'ssl') {
@@ -1412,7 +1412,7 @@ sub send_message {
14121412
$smtp->code =~ /250|200/ or die "Failed to send $subject\n".$smtp->message;
14131413
}
14141414
if ($quiet) {
1415-
printf (($dry_run ? "Dry-" : "")."Sent %s\n", $subject);
1415+
printf (($dry_run ? "Dry-" : ""). __("Sent %s\n"), $subject);
14161416
} else {
14171417
print (($dry_run ? "Dry-" : ""). __("OK. Log says:\n"));
14181418
if (!file_name_is_absolute($smtp_server)) {
@@ -1426,10 +1426,10 @@ sub send_message {
14261426
}
14271427
print $header, "\n";
14281428
if ($smtp) {
1429-
print "Result: ", $smtp->code, ' ',
1429+
print __("Result: "), $smtp->code, ' ',
14301430
($smtp->message =~ /\n([^\n]+\n)$/s), "\n";
14311431
} else {
1432-
print "Result: OK\n";
1432+
print __("Result: OK\n");
14331433
}
14341434
}
14351435

@@ -1702,15 +1702,15 @@ sub apply_transfer_encoding {
17021702
$message = MIME::Base64::decode($message)
17031703
if ($from eq 'base64');
17041704

1705-
die "cannot send message as 7bit"
1705+
die __("cannot send message as 7bit")
17061706
if ($to eq '7bit' and $message =~ /[^[:ascii:]]/);
17071707
return $message
17081708
if ($to eq '7bit' or $to eq '8bit');
17091709
return MIME::QuotedPrint::encode($message, "\n", 0)
17101710
if ($to eq 'quoted-printable');
17111711
return MIME::Base64::encode($message, "\n")
17121712
if ($to eq 'base64');
1713-
die "invalid transfer encoding";
1713+
die __("invalid transfer encoding");
17141714
}
17151715

17161716
sub unique_email_list {

0 commit comments

Comments
 (0)