]> git.ipfire.org Git - thirdparty/git.git/commitdiff
i18n: send-email: mark strings for translation
authorVasco Almeida <vascomalmeida@sapo.pt>
Wed, 14 Dec 2016 12:54:35 +0000 (11:54 -0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Dec 2016 19:00:05 +0000 (11:00 -0800)
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>
git-send-email.perl

index da81be40cb7f9af1a960be2c22f8e75c9d16822e..06e64699b45547a3e765c16cb2e410f953c05249 100755 (executable)
@@ -28,6 +28,7 @@ use File::Temp qw/ tempdir tempfile /;
 use File::Spec::Functions qw(catfile);
 use Error qw(:try);
 use Git;
+use Git::I18N;
 
 Getopt::Long::Configure qw/ pass_through /;
 
@@ -797,12 +798,12 @@ foreach my $f (@files) {
 }
 
 if (!defined $auto_8bit_encoding && scalar %broken_encoding) {
-       print "The following files are 8bit, but do not declare " .
-               "a Content-Transfer-Encoding.\n";
+       print __("The following files are 8bit, but do not declare " .
+                "a Content-Transfer-Encoding.\n");
        foreach my $f (sort keys %broken_encoding) {
                print "    $f\n";
        }
-       $auto_8bit_encoding = ask("Which 8bit encoding should I declare [UTF-8]? ",
+       $auto_8bit_encoding = ask(__("Which 8bit encoding should I declare [UTF-8]? "),
                                  valid_re => qr/.{4}/, confirm_only => 1,
                                  default => "UTF-8");
 }
@@ -829,7 +830,7 @@ if (defined $sender) {
 # But it's a no-op to run sanitize_address on an already sanitized address.
 $sender = sanitize_address($sender);
 
-my $to_whom = "To whom should the emails be sent (if anyone)?";
+my $to_whom = __("To whom should the emails be sent (if anyone)?");
 my $prompting = 0;
 if (!@initial_to && !defined $to_cmd) {
        my $to = ask("$to_whom ",
@@ -859,7 +860,7 @@ sub expand_one_alias {
 
 if ($thread && !defined $initial_reply_to && $prompting) {
        $initial_reply_to = ask(
-               "Message-ID to be used as In-Reply-To for the first email (if any)? ",
+               __("Message-ID to be used as In-Reply-To for the first email (if any)? "),
                default => "",
                valid_re => qr/\@.*\./, confirm_only => 1);
 }
@@ -918,7 +919,10 @@ sub validate_address {
        my $address = shift;
        while (!extract_valid_address($address)) {
                print STDERR "error: unable to extract a valid address from: $address\n";
-               $_ = ask("What to do with this address? ([q]uit|[d]rop|[e]dit): ",
+               # TRANSLATORS: Make sure to include [q] [d] [e] in your
+               # translation. The program will only accept English input
+               # at this point.
+               $_ = ask(__("What to do with this address? ([q]uit|[d]rop|[e]dit): "),
                        valid_re => qr/^(?:quit|q|drop|d|edit|e)/i,
                        default => 'q');
                if (/^d/i) {
@@ -1293,17 +1297,23 @@ Message-Id: $message_id
                if ($needs_confirm eq "inform") {
                        $confirm_unconfigured = 0; # squelch this message for the rest of this run
                        $ask_default = "y"; # assume yes on EOF since user hasn't explicitly asked for confirmation
-                       print "    The Cc list above has been expanded by additional\n";
-                       print "    addresses found in the patch commit message. By default\n";
-                       print "    send-email prompts before sending whenever this occurs.\n";
-                       print "    This behavior is controlled by the sendemail.confirm\n";
-                       print "    configuration setting.\n";
-                       print "\n";
-                       print "    For additional information, run 'git send-email --help'.\n";
-                       print "    To retain the current behavior, but squelch this message,\n";
-                       print "    run 'git config --global sendemail.confirm auto'.\n\n";
+                       print __ <<EOF ;
+    The Cc list above has been expanded by additional
+    addresses found in the patch commit message. By default
+    send-email prompts before sending whenever this occurs.
+    This behavior is controlled by the sendemail.confirm
+    configuration setting.
+
+    For additional information, run 'git send-email --help'.
+    To retain the current behavior, but squelch this message,
+    run 'git config --global sendemail.confirm auto'.
+
+EOF
                }
-               $_ = ask("Send this email? ([y]es|[n]o|[q]uit|[a]ll): ",
+               # TRANSLATORS: Make sure to include [y] [n] [q] [a] in your
+               # translation. The program will only accept English input
+               # at this point.
+               $_ = 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 $_;
@@ -1405,7 +1415,7 @@ Message-Id: $message_id
        if ($quiet) {
                printf (($dry_run ? "Dry-" : "")."Sent %s\n", $subject);
        } else {
-               print (($dry_run ? "Dry-" : "")."OK. Log says:\n");
+               print($dry_run ? __("Dry-OK. Log says:\n") : __("OK. Log says:\n"));
                if (!file_name_is_absolute($smtp_server)) {
                        print "Server: $smtp_server\n";
                        print "MAIL FROM:<$raw_from>\n";
@@ -1480,13 +1490,13 @@ foreach my $t (@files) {
                                $sauthor = sanitize_address($author);
                                next if $suppress_cc{'author'};
                                next if $suppress_cc{'self'} and $sauthor eq $sender;
-                               printf("(mbox) Adding cc: %s from line '%s'\n",
+                               printf(__("(mbox) Adding cc: %s from line '%s'\n"),
                                        $1, $_) unless $quiet;
                                push @cc, $1;
                        }
                        elsif (/^To:\s+(.*)$/i) {
                                foreach my $addr (parse_address_line($1)) {
-                                       printf("(mbox) Adding to: %s from line '%s'\n",
+                                       printf(__("(mbox) Adding to: %s from line '%s'\n"),
                                                $addr, $_) unless $quiet;
                                        push @to, $addr;
                                }
@@ -1500,7 +1510,7 @@ foreach my $t (@files) {
                                        } else {
                                                next if ($suppress_cc{'cc'});
                                        }
-                                       printf("(mbox) Adding cc: %s from line '%s'\n",
+                                       printf(__("(mbox) Adding cc: %s from line '%s'\n"),
                                                $addr, $_) unless $quiet;
                                        push @cc, $addr;
                                }
@@ -1534,7 +1544,7 @@ foreach my $t (@files) {
                        # So let's support that, too.
                        $input_format = 'lots';
                        if (@cc == 0 && !$suppress_cc{'cc'}) {
-                               printf("(non-mbox) Adding cc: %s from line '%s'\n",
+                               printf(__("(non-mbox) Adding cc: %s from line '%s'\n"),
                                        $_, $_) unless $quiet;
                                push @cc, $_;
                        } elsif (!defined $subject) {
@@ -1557,7 +1567,7 @@ foreach my $t (@files) {
                                next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
                        }
                        push @cc, $c;
-                       printf("(body) Adding cc: %s from line '%s'\n",
+                       printf(__("(body) Adding cc: %s from line '%s'\n"),
                                $c, $_) unless $quiet;
                }
        }