Skip to content

Commit 4649310

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 a4dde4c commit 4649310

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

git-send-email.perl

Lines changed: 17 additions & 17 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) {
@@ -1316,7 +1316,7 @@ sub send_message {
13161316
$_ = ask(__("Send this email? ([y]es|[n]o|[q]uit|[a]ll): "),
13171317
valid_re => qr/^(?:yes|y|no|n|quit|q|all|a)/i,
13181318
default => $ask_default);
1319-
die "Send this email reply required" unless defined $_;
1319+
die __("Send this email reply required") unless defined $_;
13201320
if (/^n/i) {
13211321
return 0;
13221322
} elsif (/^q/i) {
@@ -1342,7 +1342,7 @@ sub send_message {
13421342
} else {
13431343

13441344
if (!defined $smtp_server) {
1345-
die "The required SMTP server is not properly defined."
1345+
die __("The required SMTP server is not properly defined.")
13461346
}
13471347

13481348
if ($smtp_encryption eq 'ssl') {
@@ -1427,10 +1427,10 @@ sub send_message {
14271427
}
14281428
print $header, "\n";
14291429
if ($smtp) {
1430-
print "Result: ", $smtp->code, ' ',
1430+
print __("Result: "), $smtp->code, ' ',
14311431
($smtp->message =~ /\n([^\n]+\n)$/s), "\n";
14321432
} else {
1433-
print "Result: OK\n";
1433+
print __("Result: OK\n");
14341434
}
14351435
}
14361436

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

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

17171717
sub unique_email_list {

0 commit comments

Comments
 (0)