i18n: add--interactive: mark strings with interpolation for translation

Since at this point Git::I18N.perl lacks support for Perl i18n
placeholder substitution, use of sprintf following die or error_msg is
necessary for placeholder substitution take place.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Vasco Almeida 2016-12-14 11:54:27 -01:00 committed by Junio C Hamano
parent 5fa832640a
commit 13c58c1754

View File

@ -614,12 +614,12 @@ sub list_and_choose {
else { else {
$bottom = $top = find_unique($choice, @stuff); $bottom = $top = find_unique($choice, @stuff);
if (!defined $bottom) { if (!defined $bottom) {
error_msg "Huh ($choice)?\n"; error_msg sprintf(__("Huh (%s)?\n"), $choice);
next TOPLOOP; next TOPLOOP;
} }
} }
if ($opts->{SINGLETON} && $bottom != $top) { if ($opts->{SINGLETON} && $bottom != $top) {
error_msg "Huh ($choice)?\n"; error_msg sprintf(__("Huh (%s)?\n"), $choice);
next TOPLOOP; next TOPLOOP;
} }
for ($i = $bottom-1; $i <= $top-1; $i++) { for ($i = $bottom-1; $i <= $top-1; $i++) {
@ -716,7 +716,7 @@ sub revert_cmd {
$_->{INDEX_ADDDEL} eq 'create') { $_->{INDEX_ADDDEL} eq 'create') {
system(qw(git update-index --force-remove --), system(qw(git update-index --force-remove --),
$_->{VALUE}); $_->{VALUE});
print "note: $_->{VALUE} is untracked now.\n"; printf(__("note: %s is untracked now.\n"), $_->{VALUE});
} }
} }
} }
@ -1053,7 +1053,7 @@ sub edit_hunk_manually {
my $hunkfile = $repo->repo_path . "/addp-hunk-edit.diff"; my $hunkfile = $repo->repo_path . "/addp-hunk-edit.diff";
my $fh; my $fh;
open $fh, '>', $hunkfile open $fh, '>', $hunkfile
or die "failed to open hunk edit file for writing: " . $!; or die sprintf(__("failed to open hunk edit file for writing: %s"), $!);
print $fh "# Manual hunk edit mode -- see bottom for a quick guide\n"; print $fh "# Manual hunk edit mode -- see bottom for a quick guide\n";
print $fh @$oldtext; print $fh @$oldtext;
my $participle = $patch_mode_flavour{PARTICIPLE}; my $participle = $patch_mode_flavour{PARTICIPLE};
@ -1080,7 +1080,7 @@ sub edit_hunk_manually {
} }
open $fh, '<', $hunkfile open $fh, '<', $hunkfile
or die "failed to open hunk edit file for reading: " . $!; or die sprintf(__("failed to open hunk edit file for reading: %s"), $!);
my @newtext = grep { !/^#/ } <$fh>; my @newtext = grep { !/^#/ } <$fh>;
close $fh; close $fh;
unlink $hunkfile; unlink $hunkfile;
@ -1233,7 +1233,7 @@ sub apply_patch_for_checkout_commit {
sub patch_update_cmd { sub patch_update_cmd {
my @all_mods = list_modified($patch_mode_flavour{FILTER}); my @all_mods = list_modified($patch_mode_flavour{FILTER});
error_msg "ignoring unmerged: $_->{VALUE}\n" error_msg sprintf(__("ignoring unmerged: %s\n"), $_->{VALUE})
for grep { $_->{UNMERGED} } @all_mods; for grep { $_->{UNMERGED} } @all_mods;
@all_mods = grep { !$_->{UNMERGED} } @all_mods; @all_mods = grep { !$_->{UNMERGED} } @all_mods;
@ -1415,7 +1415,8 @@ sub patch_update_file {
chomp $response; chomp $response;
} }
if ($response !~ /^\s*\d+\s*$/) { if ($response !~ /^\s*\d+\s*$/) {
error_msg "Invalid number: '$response'\n"; error_msg sprintf(__("Invalid number: '%s'\n"),
$response);
} elsif (0 < $response && $response <= $num) { } elsif (0 < $response && $response <= $num) {
$ix = $response - 1; $ix = $response - 1;
} else { } else {
@ -1457,7 +1458,7 @@ sub patch_update_file {
if ($@) { if ($@) {
my ($err,$exp) = ($@, $1); my ($err,$exp) = ($@, $1);
$err =~ s/ at .*git-add--interactive line \d+, <STDIN> line \d+.*$//; $err =~ s/ at .*git-add--interactive line \d+, <STDIN> line \d+.*$//;
error_msg "Malformed search regexp $exp: $err\n"; error_msg sprintf(__("Malformed search regexp %s: %s\n"), $exp, $err);
next; next;
} }
my $iy = $ix; my $iy = $ix;
@ -1622,18 +1623,18 @@ sub process_args {
$patch_mode = $1; $patch_mode = $1;
$arg = shift @ARGV or die __("missing --"); $arg = shift @ARGV or die __("missing --");
} else { } else {
die "unknown --patch mode: $1"; die sprintf(__("unknown --patch mode: %s"), $1);
} }
} else { } else {
$patch_mode = 'stage'; $patch_mode = 'stage';
$arg = shift @ARGV or die __("missing --"); $arg = shift @ARGV or die __("missing --");
} }
die "invalid argument $arg, expecting --" die sprintf(__("invalid argument %s, expecting --"),
unless $arg eq "--"; $arg) unless $arg eq "--";
%patch_mode_flavour = %{$patch_modes{$patch_mode}}; %patch_mode_flavour = %{$patch_modes{$patch_mode}};
} }
elsif ($arg ne "--") { elsif ($arg ne "--") {
die "invalid argument $arg, expecting --"; die sprintf(__("invalid argument %s, expecting --"), $arg);
} }
} }